suppose to have the following:
ID DATE1 DATE2 Value 1 10JAN2019 10FEB2019 1 1 10JAN2019 10FEB2019 1 2 01MAR2020 15MAY2020 0 3 11MAR2022 18JUN2021 1 3 11MAR2022 18JUN2021 1 3 11MAR2022 18JUN2021 1
Is there a way to get the following?
ID DATE1 DATE2 Value 1 10JAN2019 10FEB2019 1 1 10JAN2019 10FEB2019 0 2 01MAR2020 15MAY2020 0 3 11MAR2022 18JUN2021 1 3 11MAR2022 18JUN2021 0 3 11MAR2022 18JUN2021 0
In other words, for repeated rows the "Value" must be reported once and set to 0 for the remaining ones.
Thank you in advance
You are describing what the automatic variable first.<variable> does
data want ;
set have ;
by id date1 date2 nostsorted ;
value = first.date2 ;
run ;