- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am having trouble using an existing Swimmer Plot program and changing it into a Spider Plot.
I'm not familiar with graphs and having trouble changing the y-axis from "one record per subject" to "% change in lesion size from baseline"
Here is the original Swimmer's plot code below:
(I believe I have to change YVAR=_n_. where "_n_" is the sequence # of each subject. And it's one subject per record).
I created a variable lespct1-lespct6, which is the "lesion percentage change from baseline".
If I can somehow use that variable instead of "_n_" then I think the graphs should change, no?
Thanks in advance!
data final;
set sw;
YVAR = _n_;
if ongoing= 1 then do;
xongo= xtime + 0.25;
end;
* if conrflag = 'Y' then
* xconrsp= -0.5 ;
* else xconrsp= . ;
format dstage stage. ;
run;
data _null_;
set final end=last;
if last then do;
call symput('viewmax', left(put(_n_,3.)));
call symput('thickn', left(put(int(250/_n_),3.)));
end;
run;
proc print data=final;run;
title;
footnote;
*ODS output, set graph orientation, size, RTF file name;
OPTIONS nodate nonumber orientation=landscape papersize='LETTER' ;
ods graphics on / height=7.5 in width=9.5 in ;
ods listing close;
ods pdf file = "&output\&pgmname..pdf" NOGTITLE NOGFOOTNOTE style=tlout;
/*************** Output graphic template***********/
Proc TEMPLATE;
define STATGRAPH gtl_graph;
begingraph/BORDER=False;
LAYOUT OVERLAY /
YAXISOPTS = (DISPLAY=(LABEL) OFFSETMIN=0.1 OFFSETMAX=0.2 LABEL="Subjects Received Drug"
LABELATTRS=(FAMILY="Arial" WEIGHT=bold SIZE=11pt)
LINEAROPTS= (VIEWMIN=1 viewmax=%eval(&viewmax-3) TICKVALUESEQUENCE=(start=1 end=&viewmax INCREMENT=1)))
XAXISOPTS = (OFFSETMIN=0.05 OFFSETMAX=0.05 LABEL="Drug Exposure (weeks)"
LABELATTRS=(FAMILY="Arial" weight=bold size=11pt) TICKVALUEATTRS=(COLOR=BLACK)
LINEAROPTS=(VIEWMIN=0 VIEWMAX=&maxweek TICKVALUESEQUENCE=(START=0 END=&maxweek INCREMENT=weekint)));
/******** draw swimmer lane bars*******/
* barchart x=YVAR y=XTIME /Group=DSTAGE Name="TYP" BARWIDTH=0.6 BARLABEL=0 stat=sum orient=horizontal;
VECTORPLOT X=XTIME Y=yvar XORIGIN=0 YORIGIN=yvar/GROUP=DSTAGE
DATATRANSPARENCY=0.4 ARROWHEADS=FALSE LINEATTRS=(PATTERN=1 THICKNESS=7 );
SCATTERPLOT X=eval(XTIME+999) Y=yvar/GROUP=DSTAGE Name="TYP" DATATRANSPARENCY=0.3 MARKERATTRS=(SYMBOL=squarefilled SIZE=9) ;
etc....
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your data appears quite complicated. Here is a simple example on how to create such a Spider plot.
http://blogs.sas.com/content/graphicallyspeaking/2016/10/24/clinical-graphs-spider-plot/
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is a "Spider Plot" supposed to look like? Google shows some Radar Plots. Is that what you want? Please share some example images, and you full code with data so we can run the program and see what is happening. Also, what Version of SAS are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The happy faces in the code is suppose to be a ": )"
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
just running your data steps, fixed some typos. However, macro variable &crdte is not found in:
xtime = round((min("&crdte"d, datepart(eosdat), datepart(eotdat)) - ex1dt)/7,0.1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
xtime = round((min('21OCT2016'd, datepart(eosdat), datepart(eotdat)) - ex1dt)/7,0.1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your data appears quite complicated. Here is a simple example on how to create such a Spider plot.
http://blogs.sas.com/content/graphicallyspeaking/2016/10/24/clinical-graphs-spider-plot/
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You want to display the tumor size change from baseline for each subject over time. This is called a SERIES plot, and needs multiple observations with (x,y) data, that are connected by line segments. When you have multiple series in the data, you need a curve id (Group) which can be the Subject column. Now, since you want to color each line by the response group classification (Complete Response, etc), you need to provide that classification as a separate option called GroupLC. This idea is also sometimes also referred to as a "Speghetti Plot",
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to change the color of the swimmer lanes?
And is there a way to add a second title to the legend outside the graphs?