BookmarkSubscribeRSS Feed
JeffU
Calcite | Level 5

Hey all, I'm finding myself hitting a brick wall here and I'm sure it's silly. 

proc sql;

create table recentapplication as

select * from fulltable where

.entered_date >  intnx ( "month" , today() , -1 )  ;

It's returning all entries.

If I change it to entered_date > today() - 30 that works though  I'm looking to do it from the beginning of previous month whenever I run it.

I'm sure this is just a stupid thing on my part but I'm slowly losing my sanity.  Any help would be greatly appreciated.

Thanks,

-Jeff

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

That's odd, the following program works fine for me.  note there is a typo in your code - dot before the entered_date.  Are you also sure the entered_date is a date variable?  Perhaps post test data where this fails?

data fulltable;
  entered_date="03MAR2014"d;
  output;
  entered_date="12NOV2014"d;
  output;
run;

proc sql;
  create table RECENTAPPLICATION as
  select  *
  from    FULLTABLE
  where   ENTERED_DATE > intnx("month",today(),-1);
quit;

JeffU
Calcite | Level 5

And that was it.  The entered_date was a datetime.  Just needed to put in a datepart() and it took care of it.  Thanks so much for the help!

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!

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.

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
  • 2 replies
  • 7578 views
  • 3 likes
  • 2 in conversation