Hi,
I'm confused about the answer of this question.
The question asks the retured date of TargetYear=intnx('year','20Jul18'd,3); and the answer is date value of 22281, which corresponds to January 1, 2021.
For me, i think the answer should be July 20, 2021. Could someone explain this question?
Thanks!
There is another option to the function example not shown that provides an "alignment" value. It takes the values of Beginning, Middle, End or Same. The default if not provided is beginning.
Your expectation would be the result of
TargetYear=intnx('year','20Jul18'd,3, 'S');
Which will attempt to set the same day of the next interval, so if the interval is 'year' you get 20Jul2021. If the interval is 'month' you get 20Oct2018.
If you have an interval of 'week' and ask for an alignment of 'M' or 'Middle' you get what ever the appropriate Wednesday would be. End would the last day of an interval, last day of the year, month or week.
There is another option to the function example not shown that provides an "alignment" value. It takes the values of Beginning, Middle, End or Same. The default if not provided is beginning.
Your expectation would be the result of
TargetYear=intnx('year','20Jul18'd,3, 'S');
Which will attempt to set the same day of the next interval, so if the interval is 'year' you get 20Jul2021. If the interval is 'month' you get 20Oct2018.
If you have an interval of 'week' and ask for an alignment of 'M' or 'Middle' you get what ever the appropriate Wednesday would be. End would the last day of an interval, last day of the year, month or week.
sas intox gives the beginning of the time period you asked always. If you ask for 156 weeks. It will calculate 156 weeks and return sunday of the week as the answer. So you have to be careful what you chose as your intent period i.e. year, week, day. The smaller the time period granularity you chose the lesser the error.
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: