Help using Base SAS procedures

Getting max text display based on a max date display

Reply
Frequent Contributor
Posts: 131

Getting max text display based on a max date display

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'

Frequent Contributor
Posts: 131

Re: Getting max text display based on a max date display

Cancel the question

Ask a Question
Discussion stats
  • 1 reply
  • 168 views
  • 0 likes
  • 1 in conversation