BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Squibbles
Fluorite | Level 6

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

4 REPLIES 4
Reeza
Super User

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

Reeza
Super User

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

Squibbles
Fluorite | Level 6

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

Squibbles
Fluorite | Level 6

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 ;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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