BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

I have to create my query so that my date is >= today and I have

market_row_eff_dt >=                  not sure what to put in???

8 REPLIES 8
ballardw
Super User

you may be looking for: Date() which returns the current date. BUT your variable name ending in DT makes me think you are actually comparing a DATETIME value, not a date. if that is the case you may be looking for DATEPART(market_row_eff_dt) ge Date().

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

I cannot get this to work within my proc sql code. I put a bit below of what I have.

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

So in my proc sql code I have

proc_cd in (&ortho)

and

datepart(market_row_eff_dt) >= date()

???

I cannot use get in the SQL statement

sassharp
Calcite | Level 5

makesure both datepart(market_row_eff_dt),

date() should be in same format. otherwise you get error.

Tom
Super User Tom
Super User

You can use DATE() to get today's date and DATETIME() to get the current time as a datetime value.

You can also use &SYSDATE9 to get the date that the program session started. and &SYSTIME to get the time it started.

You can specify a date literal in SAS by using quoted string followed by the letter d. Use the date. format.  For example today is
"06MAR2012"d

For datetime use dt as the suffix.  "01MAR2012:14:18"dt

You can use %SYSFUNC to let you call DATE() and generate the string.

"%sysfunc(date(),date9.)"d

Are you referencing an external database? or just referencing SAS datasets?  Different databases will have different ways of storing dates (datetime versus date only for example) and specifying a specific date (does it use ddMMMyyyy format like SAS or does it want YYYYMMDD or some other format.)

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

well this is my fix

market_row_eff_dt >= current date

no () no ' just current date typed as u see and a space between. how odd. guess that is how DB2 handles it

art297
Opal | Level 21

Not odd.  That is how DB2 specifies it.  Take a look at: http://www.ibm.com/developerworks/data/library/techarticle/0211yip/0211yip3.html

ballardw
Super User

And you never bothered to let us know you were reading DB2 files. All of the above solutions work on SAS datasets.

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 969 views
  • 0 likes
  • 5 in conversation