BookmarkSubscribeRSS Feed
Haris
Lapis Lazuli | Level 10

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!

2 REPLIES 2
data_null__
Jade | Level 19

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;                                                                                
Haris
Lapis Lazuli | Level 10

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????? 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1378 views
  • 0 likes
  • 2 in conversation