BookmarkSubscribeRSS Feed
shari
Calcite | Level 5

Hi All,

 

I am trying to plot line plot with median and IQR(Q1 and Q3) on the graph for each visit and group by treatment. I have used proc gplot with the below sample code and i am getting three separate figures for each treatment group. I want to see all the three treatment groups plots in a single figure. Is there is any way to get it. Please let me know,

 

Thanks in advance!

 

below are the columns in order.

Visit,visitnum,armn,armcd,median,q1,q3.

 

Baseline  0 60 DummyA   5639 2909 7221.5
Baseline  0 70 DummyB   3876 2929 6587
Baseline  0 80 DummyC  5112 3284 6686
Week1     12 60 DummyA 3304 1961 6157.5
Week12   12 70 DummyB 3496 1717 5021.5
Week12   12 80 DummyC 4266.5 3436 6504.5
Week26   26 60 DummyA 3762 2409 6233
Week26   26 70 DummyB 4377 3380 6735
Week26   26 80 DummyC 4261 3242 6084
 
 data reshape;                                                                                                      
   set stats;                                                                                                                        
   yvar=median;
   output;
   yvar=q1;                                                                                                                  
   output;                                                                                                                              
   yvar=q3;                                                                                                                  
   output;                                                                                                                              
run;                                                                                                                                    
 
/* Define the axis characteristics */
   axis1 offset=(5,5) minor=none order=(0 12 26);                                                                                            
/* Define the symbol characteristics */
   symbol1 interpol=hiloctj color=blue line=2;                                                                                          
   symbol2 interpol=none color=blue value=dot height=1.5;
 
proc sort data = reshape; by armcd; run;
 
proc gplot data=reshape;
   by armcd;
   plot yvar*avisitn median*avisitn / overlay haxis=axis1 vaxis=axis2;     
run;                                                                                                                                    
quit;  
2 REPLIES 2
shari
Calcite | Level 5

This is the dataset that I am working on.

data stats;
  input @1 avisit $10. @9 avisitn armn armcd $ median q1 q3;
  datalines; 
Baseline  0 60 DummyA 5639 2909 7221.5
Baseline  0 70 DummyB 3876 2929 6587
Baseline  0 80 DummyC 5112 3284 6686
Week1     12 60 DummyA 3304 1961 6157.5
Week12   12 70 DummyB 3496 1717 5021.5
Week12   12 80 DummyC 4266.5 3436 6504.5
Week26   26 60 DummyA 3762 2409 6233
Week26   26 70 DummyB 4377 3380 6735
Week26   26 80 DummyC 4261 3242 6084
;
run;

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
  • 2 replies
  • 923 views
  • 0 likes
  • 2 in conversation