BookmarkSubscribeRSS Feed
Zeremiel
Calcite | Level 5

Hi,

I have a dataset that looks like this

 

Id                            amount                               pay_type                            expire_date

001                             -7,3                                         1                                       17/01/2008

001                            -15,1                                      1                                              .

001                            -15,1                                    1                                          .

001                             15,1                                         2                                    03/05/2015

001                             15,1                                    2                                     09/11/2019

002                            -8,6                                        1                                            .

002                             8,6                                        2                                    08/12/2018

 

I need to put in the pay_type 1 missing expire_date values the value of an expire_date of a pay_type 2 with same id and absolute amount, also, pay_type 2 can only give her expire_date once so in the posted example the dates of the two first missing values should be 03/05/2015
and 09/11/2019, the third missing value of id 002 should be 08/12/2018.
Thanks in advance.

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Show us the desired output in a table similar to the one you provided with the input data.

--
Paige Miller
Zeremiel
Calcite | Level 5
Sure, the expected result table should look like this: 


Id                            amount                               pay_type                            expire_date

001                             -7,3                                       1                                    17/01/2008

001                            -15,1                                      1                                    03/05/2015

001                            -15,1                                      1                                    09/11/2019       .

001                             15,1                                      2                                    03/05/2015

001                             15,1                                      2                                    09/11/2019

002                            -8,6                                        1                                    08/12/2018

002                             8,6                                        2                                    08/12/2018
Zeremiel
Calcite | Level 5

Sure, the expected result table should look like this: 

Id                            amount                               pay_type                            expire_date

001                             -7,3                                       1                                    17/01/2008

001                            -15,1                                      1                                    03/05/2015

001                            -15,1                                      1                                    09/11/2019       .

001                             15,1                                      2                                    03/05/2015

001                             15,1                                      2                                    09/11/2019

002                            -8,6                                        1                                    08/12/2018

002                             8,6                                        2                                    08/12/2018

Zeremiel
Calcite | Level 5

Apparently i can´t since its considered a form of spam, but must be something like: 

expire_date

 

17/01/2008   001

03/05/2015   001

09/11/2019    001   .

03/05/2015    001

09/11/2019     001

08/12/2018    002

08/12/2018    002

Every pay_type 2 has copied hew expire date only to one pay_type 1 with same absolute amount and same id.

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

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