08-04-2016 09:32 AM
I want to create one macro for the last date of the month with quotation mark and with D suffix,
I want to create another macro only with quotation mark...like:
I am trying with this:
YYQ = %SYSFUNC(INTNX(QTR, %SYSFUNC(TODAY()), -1, E) , DATE9.);
But this does not give quotation mark and D suffix
08-04-2016 09:39 AM
08-04-2016 09:48 AM
Why? Macro language is for generating text, it has no data constructs or data processing functionality. It would be far better to use Base SAS, datasets and such like for processing data. If you provide information on what you are trying to do we can provide code.
08-04-2016 11:44 AM
I would reconsider this entirely, especially for the first part.. The only place that you need "01MAR2016"D or similar would be for date literals. The actual integer values will work just as well. The literal form is so us humans understand what the code is doing instead of trying to make the conversion from 20514.
%let YYQ = %SYSFUNC(INTNX(QTR, %SYSFUNC(TODAY()), -1, E)); data _null_; x=&yyq; put "The target date is" +1 x date9.; run;
Any place you would then need '30Mar2016' would very likey work with put(¯ovar,date9.) <Note: no quote for integer looking text from above.
My experience with putting quotes into SAS macro variables is that it almost never works well in the long run or I spend way too much time getting the logic to work, especially for complex code with many variables.
Need further help from the community? Please ask a new question.