I am using SAS 9.4. I have the following code:
48221 %let userAsof='28FEB2018'd;
48222
48223 /*2.a)*/ %let lAsOf = intnx(month,&userAsOf.,0,e);
48224 %put lAsOf = &lAsof;
lAsOf = intnx(month,'28FEB2018'd,0,e)
48225
48226 /*2.b)*/ %let lAsOf = %sysfunc(intnx(month,&userAsOf.,0,e));
48227 %put lAsOf = &lAsof;
lAsOf = 21243
I am trying to reason as to why the two outputs are different by thinking about the steps that are taken chronologically behind the scenes. Please tell me if I am wrong or there is anything to be added on. Differences in the steps are highlighted in bold.
1. SAS recognizes the % sign to prompt the macro processor. userAsof is stored in Global Symbol table as text '28FEB2018'd.
2.A)
2.B)
Any help is appreciated. Thanks.
Doesn't sound like you need any help.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.