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

Hello,

I am trying to reduce the data returned from a very large table by the date (Proc sql in SAS 9.4)

The format of the column is DDYYMM8. (Number)

 

In my where clause I have tried:

where date >= 01-01-16

where date >= 01/01/16

and the reverse eg 16/01/01 etc

 

All attempts so far have resulted in dates still being returned which are older than 01/01/16

Can anyone help please?

1 ACCEPTED SOLUTION

Accepted Solutions
Haikuo
Onyx | Level 15

try this:

 

where date LE '01jan2016'd

All of the SAS date stored as numbers, counting days from 1/1/1960. So you either use the number of days directly, in this case, 20454 days from 1/1/1960, or tell SAS how to read it correctly, such as in the above example.

 

View solution in original post

2 REPLIES 2
Haikuo
Onyx | Level 15

try this:

 

where date LE '01jan2016'd

All of the SAS date stored as numbers, counting days from 1/1/1960. So you either use the number of days directly, in this case, 20454 days from 1/1/1960, or tell SAS how to read it correctly, such as in the above example.

 

Caroline_22
Calcite | Level 5

Thank you for this it's worked perfectly!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1546 views
  • 1 like
  • 2 in conversation