- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So what happens instead? What does the log say? Run the macro with MPRINT amd SYMBOLGEN on to see the exact code generated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ah good spot! i've been searching for the mistake all evening! Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 ;