I'm having problems reading the date on my sas table
id date
111 01sept10 000000
the date is september 1 2010
ive tried to read this date and produce results like this:
id date expiry
111 01sept10 000000 yes
by using a code like this
length expiry $ 10
if date < '21Apr2014' d then expiry ='yes'; , the problem is the code does not appear to recognize this date format and give incorrect results. I was thinking that the solution may be to change the format of the date to something like 01/09/2010 as this format has worked for me in the past. How do i change the code or which is the quickest way?
Thanks.
If you're dealing with an actual SAS dataset post the proc contents on it.
proc contents data=have; run;
My guess is its a date time variable so you'll need to use the date part function for the comparison:
if datepart(date) < '21Apr2014' d then expiry ='yes';
If you're dealing with an actual SAS dataset post the proc contents on it.
proc contents data=have; run;
My guess is its a date time variable so you'll need to use the date part function for the comparison:
if datepart(date) < '21Apr2014' d then expiry ='yes';
Thanks this works
thanks that works
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.