BookmarkSubscribeRSS Feed
kristiepauly
Obsidian | Level 7

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. 

 

1 REPLY 1
PaigeMiller
Diamond | Level 26
 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.

 

--
Paige Miller

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
  • 1 reply
  • 179 views
  • 0 likes
  • 2 in conversation