10-01-2012 11:11 AM
I am attempting to update my halfnorm macro for V9+, current version at
I'm having trouble with a section of the macro designed to run proc genmod repeatedly to get a simulated envelope
based on randomly generated values from a given distribution. I would prefer to have no printed output generated,
but commented out the ODS LISTING statements for now. The essence is the following loop:
%put HALFNORM: Generating &nres simulated residual sets...;
%if %sysevalf(&sysver >= 7) %then %do;
* ods listing exclude all;
%do i=1 %to &nres;
%*put Generating residual set &i;
ods output ObStats=work._hres&i(keep=&res rename=(&res=res&i));
proc genmod data=_obstat_;
%if %length(&class)>0 %then %do; class &class; %end;
%if %length(&freq)>0 %then %do; freq &freq; %end;
%if %length(&trials)=0 %then %do;
model _y&i = &model /
model _y&i/&trials = &model /
%if %length(&dist)>0 %then %do; dist=&dist %end;
%if %length(&link)>0 %then %do; link=&link %end;
%if %length(&offset)>0 %then %do; offset=&offset %end;
%if %length(&mopt)>0 %then %do; %str(&mopt) %end;
* make 'obstats' out=_hres&i(keep=&res rename=(&res=res&i));
%end; /* End %do i */
I'm getting warnings, then errors regarding the ObStats datasets when I try to use them
HALFNORM: Generating 19 simulated residual sets...
MPRINT(HALFNORM): * ods listing exclude all;
MPRINT(HALFNORM): options nonotes;
MPRINT(HALFNORM): ods output ObStats=work._hres1(keep=stresdev
MPRINT(HALFNORM): proc genmod data=_obstat_;
MPRINT(HALFNORM): class dept gender admit;
MPRINT(HALFNORM): model _y1 = dept|gender|admit@2 / dist=POISSON obstats
MPRINT(HALFNORM): * make 'obstats' out=_hres&i(keep=&res rename=(&res=res&i));
WARNING: Output 'ObStats' was not created. Make sure that the output object
name, label, or path is spelled correctly. Also, verify that the
appropriate procedure options are used to produce the requested output
object. For example, verify that the NOPRINT option is not used.
I attach the current version I'm testing, together with a log file from a test run. Can anyone see what is wrong and how to correct it?
title 'Berkeley Admissions data';
cell = trim(put(dept,dept.)) ||
%halfnorm(data=berkeley, class="dept" gender admit,
resp=freq, model=dept|gender|admit@2, dist=poisson, id=cell);
10-01-2012 01:58 PM
Is there a reason that the OUTPUT= option for creating dataset output isnt' acceptable?
The online help suggests these reasons for using this option:
The OUTPUT statement creates a SAS data set more efficiently than ODS. This can be an advantage for large data sets.
You can specify the individual statistics to be included in the SAS data set.
10-01-2012 03:50 PM
Thanks for the suggestion, but the
OUTPUT statement is not currently an option, at least not without a major re-write.
This may turn out to provide a good solution, but I'd rather see if I can tweak the ODS first.
The OUTPUT statement did not exist when the macro was originally written. It provides similar output statistics
to what is available via ODS, but seems to have been constructed by an independent contractor, because the names
of the output variables differ in a bewildering way.
10-01-2012 04:16 PM
I don't know if the attached fixes your problem, but it runs without error on 9.3.
I may have made some additional changes that I don't now remember, but the only significant ones I can recall are having changed your comments to /* */ type rather than the * type, and commenting out one additional statement, namely:
|ods listing exclude none;|
10-02-2012 03:44 AM
Or if you annony these information , you can redirect them into a txt file .
Like something :
proc printto log='c:\log.txt' ;run;