Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mp_getcols.sas File Reference

Creates a dataset with column metadata. More...

Go to the source code of this file.

Detailed Description

This macro takes the proc contents output and "tidies it up" in the following ways:

  • Blank labels are filled in with column names
  • Formats are reconstructed with default values
  • Types such as DATE / TIME / DATETIME are inferred from the formats

Example usage:

%mp_getcols(sashelp.airline,outds=work.myds)
Parameters
dsThe dataset from which to obtain column metadata
outds=(work.cols) The output dataset to create. Sample data:
NAME $ LENGTH 8 VARNUM 8 LABEL $ FORMAT $49 TYPE $1 DDTYPE $
AIR 8 2 international airline travel (thousands) 8. N NUMERIC
DATE 8 1 DATE MONYY. N DATE
REGION 3 3 REGION $3. C CHARACTER

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_getcols.sas.