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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.