- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi I would like to create a boxplot for multiple variables but not just 1 variable
ID | time_hour_1 | time_hour_2 | time_hour_3 | time_hour_4 |
1 | 40 | 122 | 21 | 12 |
2 | 20 | 112 | 12 | 66 |
3 | 30 | 143 | 14 | 43 |
4 | 35 | 145 | 17 | 43 |
5 | 22 | 124 | 10 | 12 |
I tried Proc Boxplot data = a.test;
hbar time_hour_1 time_hour_2;
RUN;
Not working. thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Of course it doesn't, HBAR isn't listed under PROC BOXPLOT, HBAR stands for horizontal bar so not sure why you think that makes sense here either.
Take a look at the documentation first, they have an example that's really close to yours.
Note that the issue is the structure of your data. Determine how to change your data structure to match theirs and you can use the exact code in the documentation (hint: PROC TRANSPOSE).
Note that at the top of the page, there's a link to the full code if you want, which gets you the full program to run and play with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Two different ways to do this, using SGPLOT instead.
data have;
input ID time_hour_1 time_hour_2 time_hour_3 time_hour_4;
cards;
1 40 122 21 12
2 20 112 12 66
3 30 143 14 43
4 35 145 17 43
5 22 124 10 12
;
;
;;
run;
data long;
set have;
array tm(*) time_hour_1 - time_hour_4;
do i=1 to dim(tm);
hour=compress(vname(tm(i)), 'kd');
Value=tm(i);
output;
end;
keep id hour value;
run;
proc sgplot data=long;
vbox value / group=hour;
run;
proc sgplot data=have;
vbox time_hour_1;
vbox time_hour_2;
run;
@radhikaa4 wrote:
Hi I would like to create a boxplot for multiple variables but not just 1 variable
ID time_hour_1 time_hour_2 time_hour_3 time_hour_4 1 40 122 21 12 2 20 112 12 66 3 30 143 14 43 4 35 145 17 43 5 22 124 10 12
I tried Proc Boxplot data = a.test;
hbar time_hour_1 time_hour_2;
RUN;
Not working. thanks!