Production Ready Macros for SAS Application Developers File Reference

Returns all files and subdirectories within a specified parent. More...

Go to the source code of this file.

Detailed Description

When used with getattrs=NO, is not OS specific (uses dopen / dread).

If getattrs=YES then the doptname / foptname functions are used to scan all properties - any characters that are not valid in a SAS name (v7) are simply stripped, and the table is transposed so theat each property is a column and there is one file per row. An attempt is made to get all properties whether a file or folder, but some files/folders cannot be accessed, and so not all properties can / will be populated.

Credit for the rename approach:



%mp_dirlist(outds=cwdfileprops, getattrs=YES)
In a Unix environment, the existence of a named pipe will cause this macro to hang. Therefore this tool should be used with caution in a SAS 9 web application, as it can use up all available multibridge sessions if requests are resubmitted. If anyone finds a way to positively identify a named pipe using SAS (without X CMD) do please raise an issue!
path=for which to return contents
outds=the output dataset to create
getattrs=YES/NO (default=NO). Uses doptname and foptname to return all attributes for each file / folder.
outds contains the following variables:
  • file_or_folder (file / folder)
  • filepath (path/to/
  • filename (just the file name)
  • ext (.extension)
  • msg (system message if any issues)
  • OS SPECIFIC variables, if getattrs= is used.
Allan Bowe

Definition in file