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;
Sorry for the typo error, please consider the class statement is same in both procedures.
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.
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
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.