DATA Step, Macro, Functions and more

Proc GenMod and ODS output

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Proc GenMod and ODS output

Hi All, 

hopefully, this will be an easy one! 

 

i'm trying to write a macro for Proc Genmod and want to save the dataset for parameter estimates and model fit. 

i've got it all working without a macro, however, when i "macrofy" it, i can't get the ODS output statement to generate the datasets.  everything else works fine.  

 

%Macro ProcGenmodMacro(LIBIN, DATAIN, varWeight, varClass, varModel, varDist, LIBOUT, DATAOUT, varKeep);
	/*ODS GRAPHICS ON;*/
	
	PROC GENMOD DATA = &LIBIN..&DATAIN. /*PLOTS= */ noprint;
		WEIGHT &varWeight. ;
		CLASS 	&varClass. ;
		MODEL AVGPRICE = &varModel.  
			/DIST = &varDist.
			 LINK = LOG
			 TYPE1
			 TYPE3
			/* CORRB
			 covb*/
			 ;
		OUTPUT 			OUT = &LIBOUT..&DATAOUT. (keep = &varKeep. &varModel.)
						PREDICTED	=	EST_AVGPRICE 
						LOWER		=	EST_LOWER_CI 
						UPPER 		=	EST_UPPER_CI
						RESDEV 		=	EST_DEVRES
						STDRESDEV	=	EST_STDDEVRES
						RESLIK 		=	EST_LIKLRES
						/*XBETA		=	EST_LINEARPREDICTOR
						STDXBETA	=	EST_SEBETA*/					
						 ;
	ods output parameterestimates =  &LIBOUT..&DATAOUT.ParamEst 
				modelfit = &LIBOUT..&DATAOUT.Modelfit  /*CorrB = CorrMatrix COVB = COVMATRIX*/;
						 
	RUN;
	
	/*ODS GRAPHICS OFF;*/
%Mend;

Accepted Solutions
Solution
‎07-23-2017 06:14 PM
Super User
Posts: 19,822

Re: Proc GenMod and ODS output

Disregard previous post.

 

NOPRINT turns off the data generation for ODS, remove that option. If you'd like to not have output close the output destinations, see the post below on how that works. 

 

http://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

View solution in original post


All Replies
Super User
Posts: 19,822

Re: Proc GenMod and ODS output

Posted in reply to Squibbles

So what happens instead? What does the log say? Run the macro with MPRINT amd SYMBOLGEN on to see the exact code generated. 

Solution
‎07-23-2017 06:14 PM
Super User
Posts: 19,822

Re: Proc GenMod and ODS output

Disregard previous post.

 

NOPRINT turns off the data generation for ODS, remove that option. If you'd like to not have output close the output destinations, see the post below on how that works. 

 

http://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

Occasional Contributor
Posts: 7

Re: Proc GenMod and ODS output

ah good spot! i've been searching for the mistake all evening! Thank you

Occasional Contributor
Posts: 7

Re: Proc GenMod and ODS output

the proc genmod runs fine and it generates the output file fine. but it doesn't do the ODS line. 

 

SYMBOLGEN and MPRINT shows the lines are generating fine:

 

MPRINT(PROCGENMODMACRO): ods output parameterestimates = GLM.Model1ParamEst modelfit =
GLM.Model1Modelfit ;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 177 views
  • 0 likes
  • 2 in conversation