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

I'm a new convert from Access and very green on EG.  I'm trying a simple query formula where I need records from the past 60 days.  The criteria in Access was simply Date()-60.  What does the filter look like in a SAS EG query?

1 ACCEPTED SOLUTION

Accepted Solutions
TomKari
Onyx | Level 15

Almost identical:

 

Using the dataset SASHELP.STOCKS as an example:

 

1. Create a new query, select the variables you want.

 

2. On the filter tab, create a new filter, and select an advanced filter.

 

3. Your filter text should be something like

 

t1.Date >= (today() - 4501)

 

(this will select all the records with date later than Jan 1, 2005).

 

4. Next, then Finish

 

5. Run your query.

 

Make sure the integer you use gets you exactly the dates you want...testing is important!

Tom

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

Depends upon whether you are using the GUI. A youtube video shows various ways to select using the GUI: https://www.youtube.com/watch?v=rNseN9tGfwM

 

Otherwise, you may only need something like between today() and today()-60

 

Art, CEO, AnalystFinder.com

 

TomKari
Onyx | Level 15

Almost identical:

 

Using the dataset SASHELP.STOCKS as an example:

 

1. Create a new query, select the variables you want.

 

2. On the filter tab, create a new filter, and select an advanced filter.

 

3. Your filter text should be something like

 

t1.Date >= (today() - 4501)

 

(this will select all the records with date later than Jan 1, 2005).

 

4. Next, then Finish

 

5. Run your query.

 

Make sure the integer you use gets you exactly the dates you want...testing is important!

Tom

EHittner
Fluorite | Level 6
Worked perfect! Much appreciated!

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 2510 views
  • 0 likes
  • 3 in conversation