Loading...
Searching...
No Matches
mpe_makesampledata.sas File Reference

Creates the sample data library DC_DEMO. More...

Go to the source code of this file.

Detailed Description

Called by makedata when the deployment asked for sample data - the SAMPLEDATA flag the deploy screen offers, off by default. It creates <path>/dcdemo, assigns it as DC_DEMO, writes the sample tables there and registers them in MPE_TABLES, so a new deployment has something to browse, filter and edit without pointing DC at a site's own data.

It is built only when the caller passes iftrue=Y - the value the deploy screens, the seed files and the configurator all send - so an absent or unrecognised flag cannot create the library.

Some of the tables are generated from a fixed rule, not copied from SASHELP, for two reasons: SASHELP is not the same on every platform, and the JS estate (sas/mocks) has no SASHELP at all. The mock's mpeMakesampledata writes those same tables from the same rule, and sas/mocks/test/makedata-sampledata.test.js compares the two on the table list and the registrations - a change here has to be made there.

The rule for the generated tables (n is the row number, 1-based):

  • STUDENTS - 20 rows: NAME=student nn, SEX=M on odd n, AGE=12+mod(n,7), HEIGHT=50+n, WEIGHT=80+n
  • VEHICLES - 30 rows: MAKE cycles Audi/BMW/Ford/Honda/Toyota, MODEL=Model nn, TYPE cycles Sedan/SUV/Wagon, ORIGIN=Europe for Audi and BMW else Asia, DRIVETRAIN=Front on odd n, MSRP=20000+n*750
  • FORMATS - 1 row: PK=1, E8601DA=01JAN2026, DTM=01JAN2026:13:45:00

The dates are recorded as their SAS values (24107 and 2082894300), which is what the tables hold, so the two estates can be compared row for row.

The fixtures after them are defined by their own data steps rather than by the rule, so the list of tables this macro writes is the data steps in the body, and the comment above each one says what it is for.

DC_DEMO is assigned here and cleared again: the caller writes the assignment into its own settings from the same flag it passed in, so the library and the config line cannot disagree about whether it is there.

Parameters
lib=The control library - mpe_tables is updated here.
path=The DC location. The library is created below it, as dcdemo.
iftrue=The caller's flag, Y or N and defaulting to N: the library is built only when it is Y. Fails closed, so a call that forgets the argument
  • or a site that has not opted in - cannot create it.

SAS Macros

Version
9.2
Author
4GL Apps Ltd

@sasjslint {"maxLineLength": 80}

Definition in file mpe_makesampledata.sas.