SAS: converting a datetime to date in where clause -


i have column in sas dataset of datetime 25.6 format; lets call column datetime. want convert date9 format in clause , check against date or date variable.

i have following code:

proc sql; select rowid, name, dob, country db.testtable cast(datetime date9.) eq '14sep2014'd ; quit; 

i error when run above code:

error 22-322: syntax error, expecting 1 of following: !, !!, &, ), *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, and, between, contains, eq, eqt, ge, get, gt, gtt, in, is, le, let, like, lt, ltt, ne, net, not, notin, or, ^, ^=, |, ||, ~, ~=.

error 202-322: option or parameter not recognized , ignored.

i same error message if use following

proc sql; select rowid, name, dob, country db.testtable cast(datetime date9.) = '14sep2014'd ; quit; 

is there better way cast datetime date9 format in sas? on appreciated

in sas use datepart() function extract date value datetime value:

where datepart(datetime) = '14sep2014'd 

there no need specify format, not affect underlying value.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -