BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
troopon
Calcite | Level 5

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)

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

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;

View solution in original post

1 REPLY 1
Patrick
Opal | Level 21

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;

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
  • 1 reply
  • 1772 views
  • 1 like
  • 2 in conversation