BookmarkSubscribeRSS Feed
SASuserlot
Barite | Level 11

I am looking to create  a table where I need to use the confidence intervals after selecting the method, I used GLMSELECT then GLM, but I am having the issue to run the GLM code because I am not sure how the macro variable created here . I see the post from @Rick_SAS . Hope can you help with my code , what is the macro variable I expect here.

 

ods output ParameterEstimates = estimates;
proc glm data=both;
class STRn STRLn trt L1 L2 L3 L4 L5 L6 L7 L8 L9 ;
model chg=base STRCVRn STRLABAn trt L1 L2 L3 L4 L5 L6 L7 L8 L9
trt*L1 trt*L2 trt*L3 trt*L4
trt*L5 trt*L6 trt*L7 trt*L8
trt*L9
/ selection= stepwise(select=SL /*sle=0.15 sls=0.2*/ ) stats=all ;
run;
/*%put &=?;*/ ( what is my macro variable will be?)
proc glm data=both;
class STRCVRn STRLABAn trt L1 L2 L3 L4 L5 L6 L7 L8 L9 ;;
model chg = /*?*/ / solution CLPARM; /* or CLB for PROC REG */
run;
ods trace off;

7 REPLIES 7
SASuserlot
Barite | Level 11

Sorry for the typo error, please consider the class statement is same in both procedures.

PaigeMiller
Diamond | Level 26

I'm a little confused by your request. Confidence intervals for what?

 

As far as I know, PROC GLMSELECT does not produce confidence intervals. PROC GLM does. Are you trying to use PROC GLMSELECT to determine the model and then PROC GLM to get confidence intervals?


What macro variable are you referring to? I don't see a need for macro variables here.

--
Paige Miller
SASuserlot
Barite | Level 11

Thanks for your response. First part of your question is right! I am trying to  to use PROC GLMSELECT to determine the model and then PROC GLM to get confidence intervals.

coming to macro variable, I was trying to follow the one of the post, I really don't have experience in these procedures. Here the link for the post

https://communities.sas.com/t5/Statistical-Procedures/Proc-GLMSelect-and-confidence-intervals/td-p/3...

PaigeMiller
Diamond | Level 26

I do not see where a macro variable is needed here. But I also don't know what you a referring to where you got the code that has a macro variable.

--
Paige Miller
SASuserlot
Barite | Level 11
sorry for the confusion, based on this code, can you able to tell me how to find the CI after selecting the model from Proc GLMSELECT
ods output ParameterEstimates = estimates;
proc glm data=both;
class STRn STRLn trt L1 L2 L3 L4 L5 L6 L7 L8 L9 ;
model chg=base STRn STRLn trt L1 L2 L3 L4 L5 L6 L7 L8 L9
trt*L1 trt*L2 trt*L3 trt*L4
trt*L5 trt*L6 trt*L7 trt*L8
trt*L9
/ selection= stepwise(select=SL /*sle=0.15 sls=0.2*/ ) stats=all ;
run;

proc glm data=both;
class STRn STRLn trt L1 L2 L3 L4 L5 L6 L7 L8 L9;
model chg =/ / solution CLPARM; /* or CLB for PROC REG */
run;
ods trace off;
Rick_SAS
SAS Super FREQ

First, do you want confidence intervals for the predicted values or for the CIs for the regression parameters (coefficients)? From your code, I am assuming you want CIs for the regression coefficients.

 

The method you want is described in the article "Which variables are in the final selected model?"

The first procedure call should be the PROC GLMSELECT, which will select the model and create the _GLSIND macro variable. You can then use the macro variable in PROC GLM to fit the selected model and get inferential statistics for that model.

 

In short, it looks like you just need to change the first procedure to GLMSELECT.

SASuserlot
Barite | Level 11
that sounds right, thanks Rick. I do have an extension to this question, my stats asked to used either PRC GLM or PROOC MIXED, so how to approach after going through the GLMSELECT. This is is the statement I got from them
"For the reduced model with stepwise selection, initially proc glmselect needs to run to assess significance of the terms in the model. Once the fixed effect terms that stay in the reduced model are determined, rerun the proc mixed to obtain the reduced model." I will try to post output too

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 790 views
  • 0 likes
  • 3 in conversation