I have two variables trigliceridbefore and trigliceridafter I want to create a boxplot I cannot find the way. I did separately, but no in the same graphic.
You don't show your data, but the data has to be arranged properly if you want both boxplots together in one plot.
Something like this:
data for_plot;
input before_after $ triglyceride;
cards;
before 24
after 31
before 39
after 33
...
before 66
after 70
;
So if your data is not in this form, you will have to manipulate it.
You don't show your data, but the data has to be arranged properly if you want both boxplots together in one plot.
Something like this:
data for_plot;
input before_after $ triglyceride;
cards;
before 24
after 31
before 39
after 33
...
before 66
after 70
;
So if your data is not in this form, you will have to manipulate it.
Here is an example to get you started:
data test;
input id trigliceridbefore trigliceridafter;
datalines;
1 10.04 11.62
2 10.24 11.98
3 10.76 11.48
4 10.41 11.31
5 10.56 11.56
6 10.62 11.31
7 10.52 11.40
8 10.69 11.13
9 10.31 11.74
10 10.10 11.45
;
proc transpose data=test out=graphData;
by id;
var triglicerid: ;
label trigliceridbefore="Before" trigliceridafter="After";
run;
proc sgplot data=graphData noautolegend;
vbox col1 / category=_label_;
xaxis display=(nolabel) reverse;
yaxis label="Triglicerides (<Units>)";
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: