BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Joliek44
Calcite | Level 5

Hello, 

I am trying to figure out how to boxplot the information below. I have been using the below equation and many other variations in SAS and has not been working. Not sure its possible, but would like assistance on trying to boxplot the data. Any suggestions would be great. 

 

 

proc boxplot data=work.wtloss;

plot pre*post wtloss;

run;

 

 

pat_idpre_weightpost_weight
1165160
2202200
3256259
4155156
5135134
6175162
7180187
8174172
9136138
10168162
11207197
12155155
13220205
14163153
15159150
16253255
17138128
18287280
19177171
20181170
21148154
22167170
23190180
24165154
25155150
26153145
27205206
28186184
29178166
30129132
31125127
32165169
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Your data set is not structured properly to permit boxplots to be drawn by PROC BOXPLOT.

 

data wtloss1;
    set wtloss;
    length time $ 4;
    time='PRE';
    wt=pre_weight;
    output;
    time='POST';  
    wt=post_weight;
    output;
    drop pre_weight post_weight;
run;
proc boxplot data=wtloss1;
    plot wt*time;
run;

Having said that, I think this is the WRONG boxplot to analyze the data. This seems to be paired measurements of weight, and the true quantity of interest is the difference between PRE and POST. In that case, you want to compute the difference in a DATA step, and then create a boxplot of the difference.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Your data set is not structured properly to permit boxplots to be drawn by PROC BOXPLOT.

 

data wtloss1;
    set wtloss;
    length time $ 4;
    time='PRE';
    wt=pre_weight;
    output;
    time='POST';  
    wt=post_weight;
    output;
    drop pre_weight post_weight;
run;
proc boxplot data=wtloss1;
    plot wt*time;
run;

Having said that, I think this is the WRONG boxplot to analyze the data. This seems to be paired measurements of weight, and the true quantity of interest is the difference between PRE and POST. In that case, you want to compute the difference in a DATA step, and then create a boxplot of the difference.

--
Paige Miller
Joliek44
Calcite | Level 5

Hello Paige, 

So, do you think its better to just boxplot each group separately, by pat id and pre weight and pat id and post weight?  

PaigeMiller
Diamond | Level 26

@Joliek44 wrote:

Hello Paige, 

So, do you think its better to just boxplot each group separately, by pat id and pre weight and pat id and post weight?  


No, this is not my recommendation. My recommendation is to create a boxplot of the differences. I don't think boxplot of PRE and boxplot of POST (in any manner of display) is not helpful here. But that's my understanding, an educated guess really, because you really haven't stated why you are analyzing this data and what you want to get out of the analysis.

--
Paige Miller
Joliek44
Calcite | Level 5

Yes, for sure. I did run the data and got boxplot done. Thank you. 

 

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