Hi
I have a macros variable for year defined by %let year = 2016;
I want to use this within a date parameter as below but I can't seem to amend my code so it works. At the moment I am getting 0 records where as if I run without the macros variable and just use 2016 instead it returns records. How can I adjust so this works?
data want;
set have;
where date = "01AUG&aat_year_ty."d;
run;
(0 records returned)
data want;
set have;
where date = '01AUG2016'd;
run;
(300 rows)
What does the SAS log tell you? Any warnings?
You say your macro variable is &year but then you use a macro variable &aat_year_ty in your code. Which one is the correct name.
The following should work:
%let year = 2016;
data want;
set have;
where date = "01AUG&year"d;
run;
What does the SAS log tell you? Any warnings?
You say your macro variable is &year but then you use a macro variable &aat_year_ty in your code. Which one is the correct name.
The following should work:
%let year = 2016;
data want;
set have;
where date = "01AUG&year"d;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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: