BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

data step_1300 step_1302;

set my_steps;

if step_cd='1300' then output m_1300; else

if step_cd='1303 then output m_1302;

run;

data m_1300;

set m_1300;

1300_dt=compl_dt;

step1300=step_cd;

format 1300_dt mmddyy10.;

run;

data m_1302;

set m_1302;

1302_dt=compl_dt;

step1302=step_cd;

format 1300_dt mmddyy10.;

run;

data merge;

merge m_1300 m_1302;

by loan_num;

date1=max(1300_dt.1302_dt);

run;

sample output

Loan_Num       date1                    step_cd

00000              6/15/2014               "the max step cd according to the step date"

Here is my question. I can get the max compl_dt as shown here.  I need to be able to also show the max step (step1300 or step1302  and apply this to multiple dates and step cd) I am just using two here as example.  So if step1300 ended up being the max date I want to display in a char column '1300'

1 REPLY 1
Q1983
Lapis Lazuli | Level 10

Cancel the question

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 906 views
  • 0 likes
  • 1 in conversation