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!
YVAR = _n_;
if ongoing= 1 then do;
xongo= xtime + 0.25;
* if conrflag = 'Y' then
* xconrsp= -0.5 ;
* else xconrsp= . ;
format dstage stage. ;
set final end=last;
if last then do;
call symput('viewmax', left(put(_n_,3.)));
call symput('thickn', left(put(int(250/_n_),3.)));
proc print data=final;run;
*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***********/
define STATGRAPH gtl_graph;
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) ;
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?
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",
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.