Dear All:
Here is the code I wrote:
Data want ; set have;
if Year < 2015 then VarA = INTCK ('Minute25.' , '10:00:00't , time); else
if year >= 2015 then VarA = INTCK ('Minute25.' , '09:15:00't, time) ;
run;
I cannot get the 25 minute intervals starting at different times for the different years. What mistake am I making?
Randy
Hello @RandyStan,
I think for year >= 2015 you want to count 25-minute intervals starting at '09:15:00't, i.e., the first interval ends at '09:39:59't. For this you need to request the continuous method in the fourth argument of the INTCK function:
if year >= 2015 then VarA = INTCK ('Minute25', '09:15:00't, time, 'c');
With the default discrete method the first interval boundary after '09:15:00't is between '09:34:59't and '09:35:00't = 23*'0:25:00't (integer multiple of the interval starting at '0:00:00't). You don't have this problem for the other years because '10:00:00't (unlike '09:15:00't) happens to be an integer multiple of '0:25:00't: '10:00:00't = 24*'0:25:00't. So in that case the discrete and the continuous method yield the same results. For consistency and clarity you could specify the 'c' argument in both cases.
Edit:
Example: The number of 25-minute intervals from 9:15 through 10:28 is ...
Hi @RandyStan,
does it work for the years < 2015?
Best
Markus
Maxim 2.
Please post the complete log of your step.
Hello @RandyStan,
I think for year >= 2015 you want to count 25-minute intervals starting at '09:15:00't, i.e., the first interval ends at '09:39:59't. For this you need to request the continuous method in the fourth argument of the INTCK function:
if year >= 2015 then VarA = INTCK ('Minute25', '09:15:00't, time, 'c');
With the default discrete method the first interval boundary after '09:15:00't is between '09:34:59't and '09:35:00't = 23*'0:25:00't (integer multiple of the interval starting at '0:00:00't). You don't have this problem for the other years because '10:00:00't (unlike '09:15:00't) happens to be an integer multiple of '0:25:00't: '10:00:00't = 24*'0:25:00't. So in that case the discrete and the continuous method yield the same results. For consistency and clarity you could specify the 'c' argument in both cases.
Edit:
Example: The number of 25-minute intervals from 9:15 through 10:28 is ...
Thanks much
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.