Date format variable values

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

Date format variable values

I have a SAS dataset containing a date variable in date9. format. It shows for example 01JAN2015, and double click on it it shows 1/2/2015. When I want to state the value in my code, for example:

 

proc print data = xxx;
where date = 02JAN2015;
run;

 

It does not seem to work. I know you can't put '' around it, as it's a numerical value. I have also tried other tweaks to present the same date, but still no good. What am I doing wrong? Thanks.


Accepted Solutions
Solution
‎03-08-2016 12:40 PM
Super User
Posts: 17,760

Re: Date format variable values

You specify a date in SAS using the Date9 format, enclosed in quotes, followed by a d - to specify date. A dt would specify a date time value and a n would specify a variable.

 

ie.

 

where date = "01Jan2016"d;

 

View solution in original post


All Replies
Solution
‎03-08-2016 12:40 PM
Super User
Posts: 17,760

Re: Date format variable values

You specify a date in SAS using the Date9 format, enclosed in quotes, followed by a d - to specify date. A dt would specify a date time value and a n would specify a variable.

 

ie.

 

where date = "01Jan2016"d;

 

Contributor
Posts: 66

Re: Date format variable values

That works. Thank you!
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 316 views
  • 0 likes
  • 2 in conversation