Hi All,
I have a data set looking at diabetes and pulmonary function. I want to see whether GOLD (Global Initiative for Chronic Obstructive Lung Disease.) stage (with values from -1 to 4) modifies pulmonary function.
I wrote this code to calculate the change in pulmonary function from the 3rd visit (..._P3) to the first visit (..._P1).
data working4;
set working3;
change_fev1 = fev1pp_Post_p3 - fev1pp_Post_p1;
change_fev1_FVC = fev1_FVC_post_p3 - Fev1_FVC_post_p1;
run;
Then I wrote this code to see if there was effect modification.
Proc GLM data=working4;
class finalgold_P3 (ref='GOLD 0');
model finalgold_p3 = finalgold_P3 change_fev1 change_fev1_FVC; *finalgold_p3*change_fev1 finalgold_p3*change_fev1_FVC;
lsmeans finalgold_P3 change_fev1 change_fev1_FVC finalgold_P3*change_fev1_FVC finalgold_P3*change_fev1/ pdiff;
format finalgold_p3 Final_GOLD_Stage.;
run;
But I get this error
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 Proc GLM data=working4;
70 class finalgold_P3 (ref='GOLD 0');
71 model finalgold_p3 = finalgold_P3 change_fev1 change_fev1_FVC; *finalgold_p3*change_fev1 finalgold_p3*change_fev1_FVC;
72 lsmeans finalgold_P3 change_fev1 change_fev1_FVC finalgold_P3*change_fev1_FVC finalgold_P3*change_fev1/ pdiff;
ERROR: Only CLASS variables allowed in this effect.
NOTE: The previous statement has been deleted.
73 format finalgold_p3 final_gold_stage.;
74 run;
75
76 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
86
I deleted finalgold_P3 from the right side of the equation but get this error:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 Proc glm data=working4;
70 class finalgold_P3 (ref='GOLD 0');
71 model finalgold_p3 = change_fev1 change_fev1_FVC;
72 lsmeans finalgold_p3 change_fev1 change_fev1_FVC finalgold_P3*change_fev1_FVC finalgold_P3*change_fev1/pdiff;
ERROR: Effects used in the LSMEANS statement must have appeared previously in the MODEL statement.
NOTE: The previous statement has been deleted.
73 format finalgold_P3 Final_GOLD_Stage.;
74 run;
75
76 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
86
I have finalgold_P3 formatted in previous code as follows.
Proc Format;
value Final_GOLD_Stage
-1= "GOLD -1"
0 = "GOLD 0"
1 = "GOLD 1"
2 = "GOLD 2"
3 = "GOLD 3"
4 = "GOLD 4"
other = Missing;
run;
Any suggestions are greatly appreciated.
72 lsmeans finalgold_P3 change_fev1 change_fev1_FVC finalgold_P3*change_fev1_FVC finalgold_P3*change_fev1/ pdiff; ERROR: Only CLASS variables allowed in this effect. NOTE: The previous statement has been deleted.
This seems pretty clear to me. Only CLASS variables can go in LSMEANS.
I deleted finalgold_P3 from the right side of the equation but get this error:
Why would you delete finalgold_P3 from the model? it is a variable you are interested in.
72 lsmeans finalgold_p3 change_fev1 change_fev1_FVC finalgold_P3*change_fev1_FVC finalgold_P3*change_fev1/pdiff; ERROR: Effects used in the LSMEANS statement must have appeared previously in the MODEL statement. NOTE: The previous statement has been deleted.
Seems pretty clear as well.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.