Greeting!!
what I have
| shipping date | site | Subject ID | SiteIntialDate |
| 2017-03-01 | 1 | 1001 | 01-Mar-17 |
| 2017-03-01 | 1 | 1002 | . |
| 2017-03-07 | 1 | 1003 | . |
| 2018-11-14 | 1 | 1062 | . |
| 2018-11-19 | 1 | 1063 | . |
| 2018-12-02 | 1 | 1064 | . |
| 2018-01-09 | 2 | 2001 | 09-Jan-18 |
| 2018-02-02 | 2 | 2002 | . |
| 2018-03-05 | 2 | 2003 | . |
| 2018-12-19 | 2 | 2030 | . |
| 2019-01-03 | 2 | 2031 | . |
| 2017-07-07 | 3 | 3001 | 07-Jul-17 |
| 2017-11-29 | 3 | 3002 | . |
| 2017-12-12 | 3 | 3003 | . |
| 2017-09-28 | 4 | 4001 | 28-Sep-17 |
| 2017-12-14 | 4 | 4002 | . |
| 2017-12-20 | 4 | 4003 | . |
| 2018-02-01 | 4 | 4004 | . |
| 2018-02-05 | 4 | 4005 | . |
| 2018-03-28 | 4 | 4006 | . |
| 2018-05-14 | 4 | 4007 | . |
what I want
| Shipping date | site | Subject ID | SiteIntialDate |
| 2017-03-01 | 1 | 1001 | 01-Mar-17 |
| 2017-03-01 | 1 | 1002 | 01-Mar-17 |
| 2017-03-07 | 1 | 1003 | 01-Mar-17 |
| 2018-11-14 | 1 | 1062 | 01-Mar-17 |
| 2018-11-19 | 1 | 1063 | 01-Mar-17 |
| 2018-12-02 | 1 | 1064 | 01-Mar-17 |
| 2018-01-09 | 2 | 2001 | 09-Jan-18 |
| 2018-02-02 | 2 | 2002 | 09-Jan-18 |
| 2018-03-05 | 2 | 2003 | 09-Jan-18 |
| 2018-12-19 | 2 | 2030 | 09-Jan-18 |
| 2019-01-03 | 2 | 2031 | 09-Jan-18 |
| 2017-07-07 | 3 | 3001 | 07-Jul-17 |
| 2017-11-29 | 3 | 3002 | 07-Jul-17 |
| 2017-12-12 | 3 | 3003 | 07-Jul-17 |
| 2017-09-28 | 4 | 4001 | 28-Sep-17 |
| 2017-12-14 | 4 | 4002 | 28-Sep-17 |
| 2017-12-20 | 4 | 4003 | 28-Sep-17 |
| 2018-02-01 | 4 | 4004 | 28-Sep-17 |
| 2018-02-05 | 4 | 4005 | 28-Sep-17 |
| 2018-03-28 | 4 | 4006 | 28-Sep-17 |
| 2018-05-14 | 4 | 4007 | 28-Sep-17 |
Thanks
data have;
input shipping_date :yymmdd10. site $ SubjectID $ SiteIntialDate :date9.;
format shipping_date yymmdd10. SiteIntialDate date11.;
cards;
2017-03-01 1 1001 01-Mar-17
2017-03-01 1 1002 .
2017-03-07 1 1003 .
2018-11-14 1 1062 .
2018-11-19 1 1063 .
2018-12-02 1 1064 .
2018-01-09 2 2001 09-Jan-18
2018-02-02 2 2002 .
2018-03-05 2 2003 .
2018-12-19 2 2030 .
2019-01-03 2 2031 .
2017-07-07 3 3001 07-Jul-17
2017-11-29 3 3002 .
2017-12-12 3 3003 .
2017-09-28 4 4001 28-Sep-17
2017-12-14 4 4002 .
2017-12-20 4 4003 .
2018-02-01 4 4004 .
2018-02-05 4 4005 .
2018-03-28 4 4006 .
2018-05-14 4 4007 .
;
data want;
update have(obs=0) have;
by site;
output;
run;
data have;
input shipping_date :yymmdd10. site $ SubjectID $ SiteIntialDate :date9.;
format shipping_date yymmdd10. SiteIntialDate date11.;
cards;
2017-03-01 1 1001 01-Mar-17
2017-03-01 1 1002 .
2017-03-07 1 1003 .
2018-11-14 1 1062 .
2018-11-19 1 1063 .
2018-12-02 1 1064 .
2018-01-09 2 2001 09-Jan-18
2018-02-02 2 2002 .
2018-03-05 2 2003 .
2018-12-19 2 2030 .
2019-01-03 2 2031 .
2017-07-07 3 3001 07-Jul-17
2017-11-29 3 3002 .
2017-12-12 3 3003 .
2017-09-28 4 4001 28-Sep-17
2017-12-14 4 4002 .
2017-12-20 4 4003 .
2018-02-01 4 4004 .
2018-02-05 4 4005 .
2018-03-28 4 4006 .
2018-05-14 4 4007 .
;
data want;
update have(obs=0) have;
by site;
output;
run;
thank you @novinosrin, !!!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.