I am stuck and I am hoping one of the many SAS guru can assist me. I am trying to dymanically generate several .sas files that are incrementally named (e.g. PRG01.SAS, PRG02.SAS, etc.) and each of which contains slightly different contents (e.g. PRG01.SAS contains Data WORK.TMP01; Set MYTBL (FirstObs=1 OBS=1000000); run; and PRG02.SAS contains Data WORK.TMP01; Set MYTBL (FirstObs=10000001 OBS=2000000); run
The FIRSTOBS and OBS values are calculated based on a macro variable value that I compute in two prior DATA STEPs using a CALL SYMPUT. I then attempt to pass those values to my macro (which is were I think the breakdown is occuring) which it uses to calcute the FIRSTOBS and OBS values for each iteration of a %DO loop. Inside the loop, I am also opening the ODS buffer to spool off statement to the dynamically named .SAS files mentioned above.
Suggest you share some code and explain exactly what error (or undesirable result) you are getting. When deriving SYMPUT, there are resolution issues that can occur, so you always want to end each DATA (and PROC for my own opinion) with a RUN; statement, so SAS performs the compilation up to the current point in the code execution, even within a macro.
Also, consider writing a general purpose (as in one resuable) macro and re-execute it as needed passing any necessary parameters.
Thanks Scott. Great suggestion. I will definitely keep that in mind down the road. Shortly after posting my issue, I figured out what my problem was (I was using single quotes when I should have used double quotes). That simple oversight ultimately did the trick! Thanks for responding so quickly.