BookmarkSubscribeRSS Feed
lzhang2017
Calcite | Level 5

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;

3 REPLIES 3
Reeza
Super User

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

lzhang2017
Calcite | Level 5

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-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 1010 views
  • 2 likes
  • 3 in conversation