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.
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.