Withus,
When Reeza suggested this:
where date between "&year-01-01" and "&year-12-31"
Did you realize that he is using double quotes, and not two single quotes? Did you actually use double quotes and have the program still fail?
Reeza is She.
Sory to add to your mail Astounding, you would still need to have the letter d after your date literals, e.g. "&year-01-01"d
Otherwise the where is trying to compare numeric date to two characters which wont work
The OP states it's a character variable.
My date variable is string.
So the where is all wrong then:
from:
where Date between '&year-01-01' and '&year-12-31';
to (assuming per the other dates that my date is yyyy-mm-dd):
where input(Date,yymmdd10.) between "&year-01-01"d and "&year-12-31"d;
I tried, shown below:
"input(DOS, yymmdd10.)" then I got an error message: Invalid date/time "2013-01-01"d
"01Jan&year."d. ....and another error: different data types.
For your convenience I posted fake data and code above.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.