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

Hi, what is the best way to check what the latest dates are in 3 differet tables from one procedure?  The vriable 'Process_Date' is called the same in all 3 tables, however there are no linkage between the 3 tables.. like acct. number.  Also is there a way to see the same ask, but if the term 'process_Date' is called different for all 3 tables?  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User
data want (keep=max_date);
set
  table1
  table2
  table3
  end=done
;
retain max_date;
format max_date date9.;
max_date = max(max_date,process_date);
if done
then do;
  call symput('max_date',put(max_date,best.));
  output;
end;
run;

gives you both a dataset and a macro variable for further use.

View solution in original post

3 REPLIES 3
Reeza
Super User

What are you expecting for output? 3 diff dates, highest from each?

One date that's highest from all three tables? 

Kurt_Bremser
Super User
data want (keep=max_date);
set
  table1
  table2
  table3
  end=done
;
retain max_date;
format max_date date9.;
max_date = max(max_date,process_date);
if done
then do;
  call symput('max_date',put(max_date,best.));
  output;
end;
run;

gives you both a dataset and a macro variable for further use.

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