Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have four macros %LET SVCDTE1_ 1

Status
Not open for further replies.

Queryman

Programmer
Nov 4, 2002
243
US
I have four macros

%LET SVCDTE1_PRIOR = '2001-07-01';
%LET SVCDTE2_PRIOR = '2002-09-30';
%LET SVCDTE1_CURR = '2001-12-01';
%LET SVCDTE2_CURR = '2002-09-30';
I need to find the difference in months between the dates in set 1 & separately the dates in step 2 and make two new and separate macros with the month values out of them ( Example &TIMEFRAME1 &TIMEFRAME2. The answer for the 1st one is 14 & the second is 10. I know I need to use the INTCK function, but having difficulties getting it right.
Thanks in advance.

QueryMan

 
You use th intck function but you need to pass a 'from' and a 'to' var in numeric format.
%LET SVCDTE1_PRIOR = '2001-07-01';
%LET SVCDTE2_PRIOR = '2002-09-02';
%LET SVCDTE1_CURR = '2001-12-01';
%LET SVCDTE2_CURR = '2002-09-30';

*THIS IS ONLY AN EXAMPLE ****;

data _null_;

from = input(&SVCDTE1_PRIOR,yymmdd10.);
to = input(&SVCDTE2_PRIOR,yymmdd10.);

x = INTCK('month',from,to);

run;
Remember that the macro vars you are using has the date string surrounded by quotes. This may be the reason it didnt work the first time. (Of course you have to write a loop to read through the macro vars. I just wrote the simple case above.)
Have a good holiday!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top