Hi guys,
suppose to have the following:
data DB;
input ID :$20. Admission :date09. Discharge :date09. Class Value;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2015 20JAN2015 2 0.32
0001 21FEB2015 31DEC2015 2 0.32
0001 01MAR2018 30SEP2018 3 0.43
0001 01JAN2019 31DEC2019 3 0.43
0002 01JAN2015 31DEC2015 2 1.92
0002 01JAN2019 31OCT2019 2 1.92
0003 08FEB2014 10MAR2014 1 4.32
0003 16JUN2015 13JUL2015 1 4.32
0004 04MAY2016 10MAY2016 3 3.22
0004 13SEP2017 15NOV2017 3 3.22
0004 09DEC2018 31DEC2018 3 3.22
;
Is there a way to get the following?
data DB1;
input ID :$20. Admission :date09. Discharge :date09. Class Class1 Class2 Class3 Class4;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2015 20JAN2015 2 . 0.32 . .
0001 21FEB2015 31DEC2015 2 . 0.32 . .
0001 01MAR2018 30SEP2018 3 . . 0.43 .
0001 01JAN2019 31DEC2019 3 . . 0.43 .
0002 01JAN2015 31DEC2015 2 . 1.92 . .
0002 01JAN2019 31OCT2019 2 . 1.92 . .
0003 08FEB2014 10MAR2014 1 4.32 . . .
0003 16JUN2015 13JUL2015 1 4.32 . . .
0004 04MAY2016 10MAY2016 3 . . 3.22 .
0004 13SEP2017 15NOV2017 3 . . 3.22 .
0004 09DEC2018 31DEC2018 3 . . 3.22 .
;
In other words I would like to "distribute" the values of variable "Value" across all classes in Class variable.
Thank you in advance