BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Astounding
PROC Star

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?

Linlin
Lapis Lazuli | Level 10

Reeza is She.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

Reeza
Super User

The OP states it's a character variable.

My date variable is string.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

withus
Fluorite | Level 6

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 20 replies
  • 2129 views
  • 1 like
  • 8 in conversation