Hello All ,
My Statistician is looking for something similar to it
in a single plot, plot changes from Baseline to V1 and V7 stratified by treatment using boxplots that are complemented with jitter to show
State number of samples available for each visit and treatment arm within the plot.
I do not have example data to show , I am looking for an example that is similar to this . Can anybody give me an example or reference to existing example ?
Adding an example graph (drawn by hand, even) would help a lot to understand your question.
Coming up with some rough example data may help even structure the details of your question. As it is I am not sure if we are discusging 4 variables, 12 variables or something in between.
A comment on changing appearance of items in general based on the value of another variable: The typical approach involves a single group variable. So it appears that you would have to reduce the combinations reference here:
occurrence (yes,no) of XXX (by jitter shape feature)
Prior use of Treat A {yes,no} (by jitter color feature)
to a single variable that indicates the combination of shape and color
Then a DATTRMAP keyed to the value of that single variable could assign the color and marker shape when that variable is used as the group variable
All I agree with you all about mock , when I asked the statistician he referred this is in his mind using R code
p <- ggplot(data = Data, aes(y=Chg To Baseline , x= VisitBy TRT01 Agroup Factor))
p + geom_boxplot() + theme_bw() + geom_jitter(aes(colour = Prior use of Treat A {yes,no} , shape= occurrence (yes,no) of XXX ))
Well not sure I am right or wrong but
While searching for an Example I came across this example by Sanjay Matange at his location but need to add a second Jitter to it
https://blogs.sas.com/content/graphicallyspeaking/files/2015/12/Box_Stat_Scatter.txt
data merged;
set sashelp.heart
sgplotdata(where=(value ne . and
stat in ('Q1' 'Q3' 'STD')));
run;
proc sgplot data=mergedGroup2;
label value='STD';
format std 5.2 q1 q3 4.1;
vbox cholesterol / category=deathcause group=sex nooutliers
nofill grouporder=ascending name='a';
scatter x=deathcause y=cholesterol / group=sex groupdisplay=cluster
grouporder=ascending jitter
markerattrs=(symbol=circlefilled size=5)
transparency=0.95 clusterwidth=0.7;
xaxistable q1 / x=cat class=grp classdisplay=cluster colorgroup=grp location=inside classorder=ascending;
xaxistable q3 / x=cat class=grp classdisplay=cluster colorgroup=grp location=inside classorder=ascending;
xaxistable std / x=cat class=grp classdisplay=cluster colorgroup=grp location=inside classorder=ascending;
xaxis display=(nolabel);
keylegend 'a' / linelength=24;
run;
Since I don't grok r then that doesn't help me at all.
Do note that your example uses a single group variable to control appearance.
This would create the combinations of values, uses the SASHELP.CLASS data set you should have available.
Proc sql; create table groups as select distinct sex,age,'JitterGrp' as id, catx('_',sex,age) as value from sashelp.class ; quit;
The variables ID and Value are required names for a DATTRMAP data set.
Use a data step to add any discrete attributes you want such as markercolor markersize markersymbol for each of the values.
Add a variable to your data set for grouping using the same syntax as used to make the value variable.
Add the Dattrmap= option to SGPLOT or SGPANEL proc statement.
Use the grouping variable as the GROUP= option and indicate the ATTRID= the value of ID you associate with the group values, JitterGrp above.
Note that a single Dattrmap dataset may have multiple definitions which is why the ID values and attrid= assignment are required when using this option.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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: