sas - Using Date as Constant in expressions -
i'm having trouble calling date within if statement. date is, example, "2001-08-05". trying subset data based on date. code:
if id = "yes" , date > 2001-08-05 delete;
but doesn't i'm asking. don't error, doesn't perform ask. tried "2001-08-05"d. produced error. there way read format?
the proper format date constant in sas 'ddmmmyyyy'd
, so:
if id = 'yes' , date > '05aug2001'd
you can use either single or double quotes delimit constant. month name in constant case insensitive.
on side-note, if need date-time constant in sas, format 'ddmmmyyyy:hh:mm:ss'dt
. notice suffix becomes dt
rather d
, there semi-colon between date , time.
Comments
Post a Comment