Reputation: 14360
I have a table is SAS say t
looking like this
A B C D
--------------------------------------------------------------
VOLUME 172631922966528 IMPLIED 2012-10-04
VOLUME 173731441803264 IMPLIED 2012-10-04
PRIX_VOLUME 189124634214400 IMPLIED 2012-10-04
PRIX_VOLUME 123153895784448 IMPLIED 2012-10-04
VOLUME 266090408574976 IMPLIED 2012-10-04
VOLUME 119855364243456 IMPLIED 2012-10-04
The column D is a Date
(format yymmdd10
) colume and I have a macrovarible date0
that is worth 2012-10-04
I am trying to do a trivial data-step
data test;
set t (where=(A eq "VOLUME" and D eq &date0.));
run;
but this is not working
Can you help fix it ?
Upvotes: 0
Views: 111
Reputation: 1283
That is because when the macro variable is processed, you get:
data test;
set t (where=(A eq "VOLUME" and D eq 2012-10-04));
run;
Which SAS will resolve as:
data test;
set t (where=(A eq "VOLUME" and D eq 1998));
run;
Because it sees math instead of a date.
You need to make clear to SAS that:
1. it is not algebra.
2. it should read it as a date.
To make it read it as a string, add quotes. To make clear that the string represents a date, append a d after the quotes:
data test;
set t (where=(A eq "VOLUME" and D eq "&date0."d));
run;
That should do the trick.
Upvotes: 3