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
[in]dsThe dataset from which to obtain column metadata
[out]outds=(work.cols) The output dataset to create. Sample data:
NAME:$32. LENGTH:best. VARNUM:best. LABEL:$256. FMTNAME:$32. FORMAT:$49. TYPE:$1. DDTYPE:$9.
AIR 8 2 international airline travel (thousands) 8. N NUMERIC
DATE 8 1 DATE MONYY MONYY. N DATE
REGION 3 3 REGION $3. C CHARACTER

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_getcols.sas.