BookmarkSubscribeRSS Feed
LAP
Quartz | Level 8 LAP
Quartz | Level 8
Could someone explain why this doesn't work and how to make it work. (other than a call symput from a data step)

%let history_end_date = 01Jul2009;
%let val1 = %sysfunc(inputn(&HISTORY_END_DATE,date9.));
(This is ok up to this point); val1 = 18079;

However, neither of these statements work....

%let val2a = %sysfunc(intnx("Month",18079,1,"Begin"));
%let val2b = %sysfunc(intnx("Month",%eval(&val1),1,"Begin"));


Thanks
3 REPLIES 3
LAP
Quartz | Level 8 LAP
Quartz | Level 8
Never mind - I got it working by removing the quotes aroung month and begin. Quotes and macros have gotten me before. Could somebody explain why they are not needed in this instance.

Fix:

%let history_end_date = 01Jul2009;
%let val1 = %sysfunc(inputn(&HISTORY_END_DATE,date9.));
%let val2b = %sysfunc(intnx(Month,%eval(&val1),1,Begin));

* no quotes needed
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
When working with a DATA step and a function, you are either specifying a constant string (in quotes or double-quotes), and when using the macro %SYSFUNC interface (as well as macro language constructs), the data values themselves are treated as data-strings, unless you are using a macro variable (with an ampersand prefix).

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Correction (truncated info): "When working with a DATA step and using a function, you specify one or argument(s) as string constant (in quotes or double-quotes) and/or one or more SAS variables, and ...".

Scott Barry
SBBWorks, Inc.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1439 views
  • 0 likes
  • 2 in conversation