BookmarkSubscribeRSS Feed
Kaushansky
Obsidian | Level 7

I am trying to create a Creating Synthetic Data with SAS/OR. Attached is the file I am using and below is the code. Except I am getting the following errors?

 

598 data INPUTDATA; set SyntheticData(where=(ranuni(2023)<.5));

NOTE: There were 24372 observations read from the data set WORK.SYNTHETICDATA.
WHERE RANUNI(2023)<0.5;
NOTE: The data set WORK.INPUTDATA has 24372 observations and 13 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds


599 data METADATA; set SyntheticData(where=(ranuni(2023)>=.5));
600 run;

NOTE: There were 24470 observations read from the data set WORK.SYNTHETICDATA.
WHERE RANUNI(2023)>=0.5;
NOTE: The data set WORK.METADATA has 24470 observations and 13 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds


601
602
603 %macro GENDATA(INPUTDATA=INPUTDATA, METADATA=METADATA, OUTPUTDATA=SyntheticData,
604 MOMENTORDER=3, NUMOBS=0, MINNUMIPCANDS=0, LPBATCHSIZE=10, LPGAP=1E-3,
605 NUMCOFORTHREADS=1, MILPMAXTIME=600, RELOBJGAP=1E-4, ALPHA=0.95,
606 RANDSEED=0);
607
608 proc optmodel printlevel=0;
609 call streaminit(&RANDSEED);
610 %PRELIMINARYSTEP(INPUTDATA=&INPUTDATA, METADATA=&METADATA,
611 MOMENTORDER=&MOMENTORDER, ALPHA=&ALPHA);
612 %LPSTEP(MOMENTORDER=&MOMENTORDER, NUMOBS=&NUMOBS,
613 MINNUMIPCANDS=&MINNUMIPCANDS, LPBATCHSIZE=&LPBATCHSIZE,
614 LPGAP=&LPGAP, NUMCOFORTHREADS=&NUMCOFORTHREADS);
615 %IPSTEP(OUTPUTDATA=&OUTPUTDATA, MOMENTORDER=&MOMENTORDER,
616 NUMOBS=&NUMOBS, MINNUMIPCANDS=&MINNUMIPCANDS,
617 MILPMAXTIME=&MILPMAXTIME, RELOBJGAP=&RELOBJGAP);
618 quit;
619
620 %mend GENDATA;
621 %GENDATA;
NOTE: Line generated by the invoked macro "GENDATA".
1 %PRELIMINARYSTEP(INPUTDAT
-
180
1 ! A=&INPUTDATA, METADATA=&METADATA, MOMENTORDER=&MOMENTORDER, ALPHA=&ALPHA);
1 ! %LPSTEP(MOMENTORDER=&MOMENTORDER, NUMOBS=&NUMOBS,
WARNING: Apparent invocation of macro PRELIMINARYSTEP not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "GENDATA".
1 proc optmodel printlevel=0; call streaminit(&RANDSEED);
1 ! %PRELIMINARYSTEP(INPUTDATA=&INPUTDATA, METADATA=&METADATA, MOMENTORDER=&MOMENTORDER,
1 ! ALPHA=&ALPHA); %LPSTEP(MOMENTORDER=&MOMENTORDER, NUMOBS=&NUMOBS,
-
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro LPSTEP not resolved.
NOTE: Line generated by the invoked macro "GENDATA".
2 %IPSTEP(OUTPUTDATA=&OUTPUTDATA, MOMENTORDER=&MOMENTORDER, NUMOBS=&NUMOBS,

-

180
2 ! MINNUMIPCANDS=&MINNUMIPCANDS,
WARNING: Apparent invocation of macro IPSTEP not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE OPTMODEL used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds

 

 

2 REPLIES 2
ballardw
Super User

This part of your errors:

WARNING: Apparent invocation of macro PRELIMINARYSTEP not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "GENDATA".

Tells you that your macro named GENDATA is attempting to use another macro named PRELIMINARYSTEP.

Any macro call requires that the macro be one of compiled in the current session before use, that means execute the code that starts "%macro Preliminarystep" through a %mend statement, OR be in a file with the name of the macro and in a location that SAS has been told to look for macro code using the SASAUTOS= system option.

 

Apparently you have multiple macros, you can recognize them by names like %Preliminarystep, %Lpstep %IPstep, that need to be made available you session before running this code. Find the source files and execute them.

Of find the person that wrote your GENDATA macro and ask them where the code for these other macros should be.

 

Each SAS installed module, such as SAS/OR may also install its own macros that SAS would find. If you do not have a license for, or the module is not installed, then those SAS supplied macros would not be available. I don't recognize those as SAS/OR macros so can't tell if those might indicate missing install.

sbxkoenk
SAS Super FREQ

Hello,

 

Have you started from here?

Creating Synthetic Data with SAS/OR
By Jared Erickson on Operations Research with SAS May 17, 2017
https://blogs.sas.com/content/operations/2017/05/17/creating-synthetic-data-sasor/

 

There's a difference between

  • synthetic data (starting from an original set of data and producing a synthetic twin) and
  • simulation of data (starting from statistical properties and uni- + multivariate statistics and creating data from scratch that obey these properties and statistics).

 

For both of these exercises, SAS/OR (SAS Optimization) might not be the best option.

  • Synthetic data are best made with generative adversarial network (GAN) or transformer architecture.
  • Simulated data are best made with data steps and / or IML (matrix language) code.

Koen

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 649 views
  • 0 likes
  • 3 in conversation