SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Denali
Quartz | Level 8

Hi,

I would like to make a Kaplan-Meier curve using Proc lifetest.

I have a time variable, which was calculated from the interval between two dates. Currently, the unit is in days. How do I covert the the days iinto months so that I can plot the graph with 1-12 months on the X-axis?

 

Thank you!

 

2 REPLIES 2
Shmuel
Garnet | Level 18

Suppose you know the initial date or maybe is part of the data you can calculate the 12

dates by next code:

/* date1 is the initial date */

do m = 1 to 12;
   date = intnx('month',date1,m);
   putlog m= date= date9.;
end;

Having a sample of your data and posting the wanted output, it will enable to give you more

precise code.

 

PGStats
Opal | Level 21

Simply associate the format MONTH3. with your time (days) variable.

PG

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 751 views
  • 0 likes
  • 3 in conversation