## RE: 'A date range'

Solved
Frequent Contributor
Posts: 84

# RE: 'A date range'

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.

Accepted Solutions
Solution
‎09-30-2012 12:39 AM
Super Contributor
Posts: 1,636

## Re: RE: 'A date range'

data want;

set have;

date_9month=intnx('month',first_date,9,'s');

date_12month=intnx('month',first_date,12,'s');

run;

All Replies
Solution
‎09-30-2012 12:39 AM
Super Contributor
Posts: 1,636

## Re: RE: 'A date range'

data want;

set have;

date_9month=intnx('month',first_date,9,'s');

date_12month=intnx('month',first_date,12,'s');

run;

Frequent Contributor
Posts: 84

## Re: RE: 'A date range'

Linlin,

Thanks for you prompt help. I am going to run the code and will follow-up results.

Phan S.

Frequent Contributor
Posts: 84

## Re: RE: 'A date range'

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        .         .

Frequent Contributor
Posts: 84

## Re: RE: 'A date range'

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

🔒 This topic is solved and locked.