Hello,
My task is to calculate CD4 changes in 9 month and 12 months from the first test.
I do have the first date of CD4 testing with a format 'date9.' But I do not know how to command SAS to search 'a range of date' (9 month and one year) from the first date of testing.
I appreciate for any help. Thanks in advance.
data want;
set have;
date_9month=intnx('month',first_date,9,'s');
date_12month=intnx('month',first_date,12,'s');
run;
data want;
set have;
date_9month=intnx('month',first_date,9,'s');
date_12month=intnx('month',first_date,12,'s');
run;
Linlin,
Thanks for you prompt help. I am going to run the code and will follow-up results.
Phan S.
Dear Linlin,
Pls. kindly see the output below. No data for date_9month or date_12month.
Your further suggestion, I would appreciate. Thanks.
Ps
first_ date_ date_
Obs SOKID cd4 cd4date CD4PERC 9month 12month
1 20 332 29MAY2006 36.0 . .
2 40 20 30JAN2003 2.0 . .
3 80 222 15JAN2004 17.0 . .
4 90 20 01DEC2003 2.0 . .
Hi Linlin,
I did it. Thanks!
Ps
first_ first_ date_ date_
Obs SOKID cd4 cd4date CD4PERC 9month 12month
1 20 332 29MAY2006 36.0 28FEB2007 29MAY2007
2 40 20 30JAN2003 2.0 30OCT2003 30JAN2004
3 80 222 15JAN2004 17.0 15OCT2004 15JAN2005
4 90 20 01DEC2003 2.0 01SEP2004 01DEC2004
5 100 580 21DEC1989 36.0 21SEP1990 21DEC1990
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.