BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi All

How do I go about getting a data in the future and assigning this to a value. For example, I have to read in a list of value, e.g. A1, A2, A3 - each of these will have different due terms - e.g. A1 = Payable in 1 mth on the 25th, A2 = Payable in 2 mth on the 25th etc

So, how do I get the 25th of the following TWO and THREE months to assign to a value. I was thinking of using INTX function but don't that will work.

Thanks for your help.
Shelton.
4 REPLIES 4
ArtC
Rhodochrosite | Level 12
INTNX should do the trick. One solution might be something like:

[pre]
data adv;
date=today();
a1=1; a2=2; a3=3;
adv1 = intnx('month',date,a1)+24;
adv2 = intnx('month',date,a2)+24;
adv3 = intnx('month',date,a3)+24;
run;
[/pre]
Ksharp
Super User
Hi. INTX function has the fourth argument 'sameday' can obtain the same day after two or three months.

followdate = intnx('month',A1,2,'sameday');
deleted_user
Not applicable
thanks all for your help - I did the following:

IF NPAYTERM = 'A1' THEN DO;
NEXT_MON=INTNX('MONTH',DOCDATE,1) + 24;
R3DUED=PUT(NEXT_MON,YYMMDD10.);
SUBSTR(R3DUED,5,1) = '-';
SUBSTR(R3DUED,8,1) = '-';
PUT R3DUED;
END;

ELSE IF NPAYTERM = 'A2' THEN DO;
TWOMONTS=INTNX('MONTH',DOCDATE,2) + 24;
R3DUED=PUT(TWOMONTS,YYMMDD10.);
SUBSTR(R3DUED,5,1) = '-';
SUBSTR(R3DUED,8,1) = '-';
PUT R3DUED;
END;

etc etc

Thanks again.
ArtC
Rhodochrosite | Level 12
To show a dash as the separator consider the format yymmddd10. (notice the third d).

If all you want to do is write the value to the LOG, then you can avoid creating the variable R3DUED by using this format in the PUT statement.
[pre]
put next_mon yymmddd10.;
[/pre]

I always try to second guess the need to create a date stored in a character variable.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 990 views
  • 0 likes
  • 3 in conversation