BookmarkSubscribeRSS Feed
kristiepauly
Obsidian | Level 7

Hello, 

I am running an interaction but need to reorder the x axis variables from how it is displayed below to PRISm, GOLD 0 - GOLD 4.  Additionally, I need to change the legend diabetes_P1 to 'diabetes at baseline' and the Title to 'Change in FEV1pp'.

Proc GLM data=working4 (rename=(change_fev1pp = Change)); 
	class finalgold_P1 (ref='GOLD 0') diabetes_p1 (ref="No");
	model  Change =  finalgold_P1 diabetes_p1 finalgold_p1*diabetes_p1; 
	lsmeans diabetes_p1 finalgold_P1/ pdiff;
	format finalgold_p1 Baseline_GOLD_Stage. diabetes_p1 diabetes_baseline. diabetes_P3 diabetes_final.;
	label Change ='Change in FEV1pp';
	run;

Output: 

Change in FEV1.png

I've tried: 

1. Using rename for diabetes_P1. This does not work, I think due to the formatting of diabetes_P1 to diabetes_baseline. 

2. I tried adding Title = 'Change in FEV1pp Over 10 Years' into the code. There are no errors, but it doesn't change the title. 

Someone suggested I use ODS but I am unfamiliar with using that code.  Is there an easy way to incorporate what I need into this code?  

3 REPLIES 3
Ksharp
Super User
You are asking too many things.
Post your sas dataset and full sas code could help you to solve this problem.
PaigeMiller
Diamond | Level 26

Additionally, I need to change the legend diabetes_P1 to 'diabetes at baseline' and the Title to 'Change in FEV1pp'.

 

We need to see what you did, show us your code.

 

I tried adding Title = 'Change in FEV1pp Over 10 Years' into the code. There are no errors, but it doesn't change the title.

 

It is never sufficient to say it doesn't work. You need to show us the code that you tried.

--
Paige Miller
PaigeMiller
Diamond | Level 26

To re-order the values (not variables) on the X-axis, you would have to sort data set WORKING4 in the order that you want the values to appear. Then in PROC GLM you would use

 

Proc GLM data=working4 (rename=(change_fev1pp = Change)) order=data; 

 

 

You might also be able to use ORDER=FORMATTED but since we don't know what the format is that your are using, I can't say if that would work. 

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 466 views
  • 0 likes
  • 3 in conversation