BookmarkSubscribeRSS Feed
VALLY
Fluorite | Level 6

Good day Gurus, 

 

please assist , am trying to get a Posting date = today and value date in the future

 

data view;
set work.view2
CPR_CREATE = intnx ('week',today(),-2;
TB_POSTDAT = today() -14;
;
run;

2 REPLIES 2
ed_sas_member
Meteorite | Level 14

Hi @VALLY 

 

Could you please clarify what are the expected results?

 

ballardw
Super User

@VALLY wrote:

Good day Gurus, 

 

please assist , am trying to get a Posting date = today and value date in the future

 

data view;
set work.view2
CPR_CREATE = intnx ('week',today(),-2;
TB_POSTDAT = today() -14;
;
run;


Your intnx function call is missing a closing ). and should be throwing syntax errors in the log.

I don't see anything about the future in the above code. So Is the "value date in the future" variable supposed to be CPR_CREATE? Or something else? How far into the future? Currently it looks like you are looking for something 2 weeks in the past.

 

If TB_POSTDAT is supposed to be your "posting date = today" then why do you subtract 14? Or again is that the desired variable.

 

Variablename = today();

would create variable with the value of today.

You likely should assign a format such as DATE9. or similar so human eyes have a clue what the value is instead of the 5 digit integer you will get. Today, being 9 March 2020 will have a value of 21983 as the default format will be BEST12.

 

data example;
   x=today();
   format x date9.;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 531 views
  • 0 likes
  • 3 in conversation