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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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