Write and run SAS programs in your web browser

Why I can't store model from proc genmod in SAS studio

Reply
New Contributor
Posts: 3

Why I can't store model from proc genmod in SAS studio

Hello, Sir/Mamda:
Recently I am doing some bootstrapping by SAS stuido, I found I can't store models from proc genmod, which I can do without any problem in PC SAS. The codes and errors are at below.

Another thing I want to confirm is if SAS 9.4 will provide correct score from Zero inflated model while SAS 9.2 can't? That is reason I am using 9.4 SAS studio now.

/*****************************SAS codes************************************************/
ods select none;
ods listing close;
options mprint mlogic;
options obs=max;
data bootsample0;
set bootsample;
trd1=0;
run;
data bootsample1;
set bootsample;
trd1=1;
run;

options obs=max;
%macro mod_bstrap(dist, distnm, y, pre_y);
proc genmod data=bootsample;
by replicate;
class trd1(ref="0") sex dx_dep tscore attempt_bas disorder_bas ideation_bas
trauma_bas anxi_bas sub_bas age_group;
model &y=&pre_y trd1 age_group sex anxi_bas sub_bas dx_dep tscore
attempt_bas disorder_bas ideation_bas trauma_bas /dist=&dist;
store sasuser.model_&distnm.;
%if %index(&distnm, lognm) >=1 %then
%do;
output out=testout_&distnm(keep=patid trd1 pred00 replicate) pred=pred00;
%end;
%else %if %index(&distnm, zip) >=1 %then
%do;
zeromodel &pre_y trd1 age_group sex anxi_bas sub_bas dx_dep tscore
attempt_bas disorder_bas ideation_bas trauma_bas;
%end;
run;
quit;
...
%mend;

/**************************Log file********************************************************/
284 %mod_bstrap(zip, zip, ihos_los_1yr, log_allpre_los);
MLOGIC(MOD_BSTRAP): Beginning execution.
MLOGIC(MOD_BSTRAP): Parameter DIST has value zip
MLOGIC(MOD_BSTRAP): Parameter DISTNM has value zip
MLOGIC(MOD_BSTRAP): Parameter Y has value ihos_los_1yr
MLOGIC(MOD_BSTRAP): Parameter PRE_Y has value log_allpre_los
MPRINT(MOD_BSTRAP): proc genmod data=bootsample;
MPRINT(MOD_BSTRAP): by replicate;
MPRINT(MOD_BSTRAP): class trd1(ref="0") sex dx_dep tscore attempt_bas disorder_bas ideation_bas trauma_bas anxi_bas sub_bas
age_group;
MPRINT(MOD_BSTRAP): model ihos_los_1yr=log_allpre_los trd1 age_group sex anxi_bas sub_bas dx_dep tscore attempt_bas disorder_bas
ideation_bas trauma_bas /dist=zip;
MPRINT(MOD_BSTRAP): store sasuser.model_zip;
MLOGIC(MOD_BSTRAP): %IF condition %index(&distnm, lognm) >=1 is FALSE
MLOGIC(MOD_BSTRAP): %IF condition %index(&distnm, zip) >=1 is TRUE
MPRINT(MOD_BSTRAP): zeromodel log_allpre_los trd1 age_group sex anxi_bas sub_bas dx_dep tscore attempt_bas disorder_bas
ideation_bas trauma_bas;
MPRINT(MOD_BSTRAP): run;


ERROR: Write access to member SASUSER.MODEL_ZIP.ITEMSTOR is denied.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

MPRINT(MOD_BSTRAP): quit;
MLOGIC(MOD_BSTRAP): %IF condition %index(&distnm, lognm) >=1 is FALSE
MLOGIC(MOD_BSTRAP): %IF condition %index(&distnm, tp) >=1 is FALSE


NOTE: PROCEDURE PLM used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

MPRINT(MOD_BSTRAP): proc plm source=sasuser.model_zip;
ERROR: The file SASUSER.MODEL_ZIP does not exist or it is not a valid item store.
NOTE: The SAS System stopped processing this step because of errors.
MPRINT(MOD_BSTRAP): score data=bootsample0 out=t0_zip_bs(keep=patid pred0 replicate trd1) PREDICTED=pred0 / ilink;
MPRINT(MOD_BSTRAP): run;

NOTE: PROCEDURE PLM used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

MPRINT(MOD_BSTRAP): proc plm source=sasuser.model_zip;
ERROR: The file SASUSER.MODEL_ZIP does not exist or it is not a valid item store.
NOTE: The SAS System stopped processing this step because of errors.
MPRINT(MOD_BSTRAP): score data=bootsample1 out=t1_zip_bs(keep=patid pred0 replicate trd1) PREDICTED=pred0 / ilink;
MPRINT(MOD_BSTRAP): run;

Grand Advisor
Posts: 16,343

Re: Why I can't store model from proc genmod in SAS studio

SASUSER library is read only on SAS UE. Use a different library and it will work fine. 

New Contributor
Posts: 3

skip not converged datasets Re: Why I can't store model from proc genmod in SAS studio

thanks alot! It is working. But some of bootstrapping datasets didn't converge on the current model. I am wondering if there is away to skip those results and only use converged ones?

If there is a indicator in the store model dataset or somewhere can show if it is converged or not? 

or when it runs through all datasets, I am wondering if it could be skipped to next dataset if this one won't converge. Sometimes it stopped totally. 

 

I used proc plm, show the model dataset, but not very informative....

 

thanks 

Ling 

SAS Super FREQ
Posts: 3,232

Re: skip not converged datasets Re: Why I can't store model from proc genmod in SAS studio

This article describes "how to monitor convergence during simulation studies in SAS."  The same ideas apply to your bootstrap analysis.

Post a Question
Discussion Stats
  • 3 replies
  • 95 views
  • 2 likes
  • 3 in conversation