Hi All,
I have a SAS MACRO to generate data and then analyze them using PROC GLIMMIX and save/output estimates of fixed effects. The trial running of 10 replications was fine so I let it run 100 replications. After waiting for a few days, it looks like the SAS MACRO finished, but, SAS is not responding. Though I got all files (so far as I checked), I am not fully sure the simulation is done and the estimates are correct. Besides, the log file and the output file are not complete for sure. I don't want to force the program to close because I want to check the log and output file.I'm afraid to lose the information. I attached the set up of my MACRO. Thanks for your time and any comments are appreciated.
PROC PRINTTO LOG= "C:\DISSERTATION\SIMULATION\LL.txt"
PRINT="C:\DISSERTATION\SIMULATION\OUTPUT.TXT" ;
*options symbolgen ;
%MACRO SIMU(MC);
%DO SSDIF=1 %TO 2;
%IF &SSDIF=1 %THEN %LET SDIF=0.5; *STUDENT LEVEL DIF size: 0.5;
%IF &SSDIF=2 %THEN %LET SDIF=0.8; *STUDENT LEVEL DIF size: 0.8;
%DO STDIF=1 %TO 2;
%IF &STDIF=1 %THEN %LET TDIF=0.5; *TEACHER LEVEL DIF size: 0.5;
%IF &STDIF=2 %THEN %LET TDIF=0.8; *TEACHER LEVEL DIF size: 0.8;
%DO SRF=1 %TO 2;
%IF &SRF=1 %THEN %LET RF=0.5; *50% REFERENCE GROUP;
%IF &SRF=2 %THEN %LET RF=0.8; *80% REFERENCE GROUP;
%DO NTDIF=1 %TO 4;
%IF &NTDIF=1 %THEN %LET NDIF=0.125; *5 ITEMS;
%IF &NTDIF=2 %THEN %LET NDIF=0.25; *10 ITEMS;
%IF &NTDIF=3 %THEN %LET NDIF=0.375; *15 ITEMS;
%IF &NTDIF=4 %THEN %LET NDIF=0.50; *20 ITEMS;
%DO NL=1 %TO 2;
%IF &NL=1 %THEN %LET NLVL=1; *TEACHER-STUDENT LEVELS;
%IF &NL=2 %THEN %LET NLVL=2; *TEACHER LEVEL ONLY;
%let FF=%sysevalf(1-&RF);
%let step=%sysevalf(1/&FF);
/*DO-LOOP FOR replications*/;
%DO C=1 %TO &MC;
%IF &NLVL=1 %THEN %DO;
*syntax of generate data and analyze data;
%END;
%ELSE %DO
*syntax of generate data and analyze data;
%END;
%END;
%END;
%END;
%END;
%END;
%END;
%MEND SIMU;
%SIMU(100);
QUIT;
Just a wild guess ... the problem is somewhere in
*syntax of generate data and analyze data;
You might want to write the LOG to a file and then if you have to kill the program, you can still inspect the LOG
Yes, without the log, all suggestions fall into the category of "wild guess". Here are a couple of ideas.
First, notice you are missing a semicolon after %ELSE %DO. Perhaps the semicolon is actually there but the cut-and-paste-for-posting-purposes erased it.
Also, notice that one way to get this result would be if "syntax to generate data and analyze data" contained a statement like this:
%if &c > 50 %then %let c=50;
That would turn your macro logic into an infinite loop when you increase &MC to 100.
Thanks, Astounding. There is a semicolon in the syntax. I must eliminate in the post by mistake. I don't have such condition like &c>50. As I checked the log, there are errors in PROC IML for one replication but no errors related to the logic flow.
Thanks, Paige. I checked the log though. You are right, the 26th replication of one condition went wrong in PROC IML. But anything before or after is correct. So weird. I have to look up why that happened now.
One thing to try is to make sure to end your procs and data steps with explicit RUN or QUIT statements.
You are definitely missing the RUN from the PROC PRINTTO at the top. And there is no reason why you should need a QUIT at the bottom.
Might not fix the problem but will make the log easier to read.
Thanks Tom for your input. I have worked for quite a while to fix other problems and I have figured out why SAS did not respond. I forgot to change the way to show results so SAS created html showing results. Thanks again to all.
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.