These macro programs are essentially long, complex,
stored processes that enable to the user to efficiently re-use programs
without copying-and-pasting the code, which would cause issues when one
version is changed but not another. These macro programs are more
typical of what is found online and in-house.
CheckLogCheck logs for issues. See the CheckLog page for more information.CompressDSCompress a data set using either the DATA step or PROC DATASETS.CopyDataCopy data from one library to another, with various additional options.CopyFileCopy a file using an operating system command.DirListGenerate a data set that contains a listing of the files in a directory, optionally including subdirectories and filtering for a specific extension.DropTableCheck if a table exists and then delete it. Avoids generating an issue in the log if the data set is already gone.NapTimePut SAS to sleep for a specified period of time. Useful when scheduled tasks are not available.NoLabelRemove labels from a data set.NumberNameOutput a new variable that contains the names of numbers instead of the number. For example, if the source variable contains 1000, the output variable would be "One thousand".RandomSetGenerate a random set of data based on one of two processing options. Type 2 is generally faster for large data sets. The RAND function is used to select observations.RenameVarsRename variables in a data set based on a mapping data set that contains source and target names.ReorderChange the order of variables in a data set based on a list or an example data set.SearchCodeSearch SAS code for a term or a regular expression. Useful when SAS code is not indexed by the operating system or to generate a data set that contains a list of code for various purposes (e.g. batch code revisions).SelectStatSelect records that match a specific statistic (usually MIN or MAX of a variable). Useful for processing some duplicate observations; for example, to select the most recent date for a set of records for a person (MAX).SiteMacrosDownload macros from this site!TeaTimerPut SAS to sleep to time tea steeping. Useful when the user can't install software.TextExportExport a data set as a text file. Uses PROC EXPORT and tab as a delimiter.TextIDCreates an ID for a text field that will be the same whenever it's run. Useful when an ID is needed (especially for categorical variables), the source does not have an ID, and the ID needs to be the same each time it is generated. The process converts each character into its binary representation, converts the binary number to decimal, then sums up each decimal representation of the characters. Note that this process is therefore case sensitive, and two IDs will be generated for slightly different values (e.g., "Commercial" and "commercial" will have different IDs).ViewLibGenerates a series of views based on a library, output to a new library (thus, "ViewLib"). This can be useful when renaming data sets or variables in a library without changing the source library.XDLMImport a file without delimiting it (i.e., with only one column). Useful when importing a file that has only one "thing" in it, for example, the SAS log, which consists of only text. |
Categories >