BookmarkSubscribeRSS Feed
Sotarkadin
Calcite | Level 5

I currently have a data set that shows dates different actions have happened.  I am trying to figure out the number of days since that date based on the day the program is ran.

 

open_dt, ocfr_dt, lwsi_dt, pcse_dt, pcna_dt, close_dt

 

I have a column that has the status based on which date is filled in.  Based on the status I need it to subtract that subsequent column from the date the pgroam is run.

I delcare the variable today at the top.

data _null_;
today=today();
call symput('today', put(today,date9.));
run;

and I wrote it like this but get a syntax error.

 

data fraud_ovrvw4;
set fraud_ovrvw3;
if frd_status = 'Support Requested' then updt_tm = (lwsi_dt - &today.);
run;

I am not sure the syntax to get updt_tm to tell me how many days between the column_name I want it to look and the day its ran.

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

Like this?

 

data fraud_ovrvw4;
  set fraud_ovrvw3;
  if frd_status = 'Support Requested' then updt_tm = (lwsi_dt - today() );
run;
Sotarkadin
Calcite | Level 5

That is what I tried the first time and the column updt_tm comes back blank.  Does it matter the format, as the date in the data set is ddmmmyyyy

Reeza
Super User

Did you get an error?

Format shouldn't matter, but the type does, is it a character or numeric variable?

ChrisNZ
Tourmaline | Level 20

The format doesn't matter. If it comes back missing then the input value is missing too.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 914 views
  • 0 likes
  • 4 in conversation