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

I have SQL date time field that downloaded as text field.
03/01/2021 11:35
used the following code to read..
input(trans_Date,anydtdtm.) as Date_Transfered format=dtdate9.,
but when I try to query the data :

where Date_Transfered >= '01MAR2021'd; where clause is not working and it's pulling all the observations.

 

What did I miss? 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

You do a god jobs of transforming the string into a datetime.

That means you must filter on a datetime value:

datepart(DATE_TRANSFERED) >= '01MAR2021'd;

or (better)

DATE_TRANSFERED >= '01MAR2021:00:00:00'dt;

 

Hint: look at the unformatted values when in doubt.

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

You do a god jobs of transforming the string into a datetime.

That means you must filter on a datetime value:

datepart(DATE_TRANSFERED) >= '01MAR2021'd;

or (better)

DATE_TRANSFERED >= '01MAR2021:00:00:00'dt;

 

Hint: look at the unformatted values when in doubt.

Stalk
Pyrite | Level 9
Thank you. It works.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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