I am using SAS Enterprise Guide to run simulations with PROC GLIMMIX. I don't want the results for the thousands of runs to show up in the default SASReport destination and I need to write the random solution to a SAS dataset. No problem, this code does the trick:
ods results OFF;
proc glimmix; by simulationN; model y = x; random r / s; ods output SolutionR=SRout; run;
ods results ON;
However, if I add any code outside of of the RESULTS ON/OFF block, the effects of ODS RESULTS OFF is negated. For example, if I want to obtain the mean of random estimates and use PROC SQL to calculate that, the results of all 1,000 simulations will be pushed to ODS SASReport which takes a while to write.
ods results OFF; proc glimmix; by simulationN; model y = x; random r / s; ods output SolutionR=SRout; run; ods results ON;
proc sql; select mean(Estimate) from SRout; quit;
Is this a normal SEG behavior or am I missing something?
I cannot use ODS SELECT NONE / EXCLUDE ALL or NOPRINT option because that suppresses the writing of the SolutionR to SAS dataset.
The work-around I use is to use ODS _ALL_ CLOSE before PROC GLIMMIX and then re-enable ODS TagSet.SASReport File=EGSR afterwards. But I would like to understand this strange behavior of ODS RESULTS commands?
Thank you in advance!
I haven't tested PROC GLIMIX but I use select none and ODS OUTPUT all the time with PROC MEANS.
ods select none;
proc means data=&_m._sl n mean std median min max completetypes stackodsoutput;
class &trt / order=data preloadfmt mlf missing;
var &continuous;
ods output summary=&_m._cvars(rename=(variable=_variable_) index=(cvars=(_variable_ &trt)));
run;
ods select all;
Thanks for setting me on the right path. Curiously, the location of ODS SELECT NONE matters. The code I used does not write SRout dataset:
proc glimmix;
by simulationN;
model y = x;
random r / s;
ods output SolutionR=SRout;
ods select none;
run;
However, if I switch the two ODS lines, the output is produced just like you suggested:
proc glimmix;
by simulationN;
model y = x;
random r / s;
ods select none;
ods output SolutionR=SRout;
run;
Thanks.
Now, why is ODS RESULTS OFF/ON block negated by the PROC SQL that follows it?????
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.