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

Hi Experts ,

I have a dataset below , I need to find the 96 hr dates i to a different column Called "Date 96" I was using a filter in the Timepont variable like timepoint="96hr". 

But now my requirement is i need to take the last date if the subject is reacched 96hr timepoint and if the subject is not reached 96 hr time point (eg:Subject 102) then i dont need show that date.i Date 96 column

Subject Timepoint           Date
100        24hr                 12/10/2020
100        36hr                12/11/2020
100       96hr                  12/12/2020
101       24hr                 12/9/2021
101       36hr                30/10/2021
101       96hr               15/10/2021
101       Rate Change  25/12/2021
102        24hr              12/9/2021
102        36hr              30/10/2021
102       Rate Change 25/12/2021

 So the new column should looks like below

 

Subject Timepoint           Date             96hrdate
100        24hr                 12/10/2020
100        36hr                12/11/2020
100       96hr                  12/12/2020    12/12/2020
101       24hr                 12/9/2021
101       36hr                30/10/2021
101       96hr               15/10/2021
101       Rate Change  25/12/2021    25/12/2021
102        24hr              12/9/2021
102        36hr              30/10/2021
102       Rate Change 25/12/2021

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

Please post data in usable form.

What i would do:

  • a data step with by
  • retain a flag set to 1 when Timepoint = '96hr'
  • use first to reset flag
  • use last to set hrdate96 to Timepoint if flag is 1

View solution in original post

1 REPLY 1
andreas_lds
Jade | Level 19

Please post data in usable form.

What i would do:

  • a data step with by
  • retain a flag set to 1 when Timepoint = '96hr'
  • use first to reset flag
  • use last to set hrdate96 to Timepoint if flag is 1
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 715 views
  • 1 like
  • 2 in conversation