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

Create sample data based on the structure of an empty table. More...

Go to the source code of this file.

Detailed Description

Many SAS projects involve sensitive datasets. One way to ensure the data is anonymised, is never to receive it in the first place! Often consultants are provided with empty tables, and expected to create complex ETL flows.

This macro can help by taking an empty table, and populating it with data according to the variable types and formats.

TODO:

  • Consider dates, datetimes, times, integers etc

Usage:

proc sql;
create table work.example(
  TX_FROM float format=datetime19.,
  DD_TYPE char(16),
  DD_SOURCE char(2048),
  DD_SHORTDESC char(256),
  constraint pk primary key(tx_from, dd_type,dd_source),
  constraint nnn not null(DD_SHORTDESC)
);
%mp_makedata(work.example)
Parameters
[in]libdsThe empty table (libref.dataset) in which to create data
[out]obs=(500) The maximum number of records to create. The table is sorted with nodup on the primary key, so the actual number of records may be lower than this.

SAS Macros

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mp_makedata.sas.