BookmarkSubscribeRSS Feed
kalbaugh
Calcite | Level 5

I'm trying to get the 'number at risk' (n in my code below) using xaxistable on my sgplot figure. However, I was expecting the 'n' to be aligned with the x axis timepoints (0, 6, 12, 18, 24, 30, and 36). Instead, the n is showing up at every timepoint where there is an actual change. So there are many more 'n' on the figure than needed - and not the ones I want. Does anyone know how to get the 'n' for your predefined x axis timepoints? My code is below. Figure is attached.

 

proc sgplot data=b11 ;

step x=fuptime y=s/group=trivex name='s' ;

xaxistable n / x=fuptime class=trivex location=outside colorgroup=trivex separator

;

 

styleattrs

datacontrastcolors=(black gray)

datalinepatterns=(solid);

format trivex trivex.;

yaxis values=(0.5 to 1.0 by 0.1);

xaxis values=(0 to 36 by 6);

yaxis label="Proportion of Patients with No Ulcer Recurrence (%)";

 

label fuptime=Length of Follow-Up (Months);

label trivex=Phlebectomy;

 

keylegend 's';

run;

4 REPLIES 4
arodriguez
Lapis Lazuli | Level 10

You could edit your dataset to delete n content when timepoint is not in your list.

Reeza
Super User

Yes, I would recommend editing the data. Use timelist option in proc lifetest to limit data. 

Jay54
Meteorite | Level 14

Suggestions by Reeza and Rodriguez are in the right direction.  See the SAS 9.4 (last) example in the Survival Plot article.  While the Step plot uses X=TIME, the xaxistable uses the optional X=TATRISK.  See the data set shown in the article.  TATRISK has non-missing values only at 0, 500, 1000 and so on, so the ATRISK values are shown only where TATRISK is non-missing.  Full program is provided in a link at the bottom of the article.

kalbaugh
Calcite | Level 5

Thanks everyone! Huge help.

All the best,

Corey

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1475 views
  • 3 likes
  • 4 in conversation