Hi , i have a data like below , i have to remove the missing cells , please suggest how to do so
have ..
ID | shift_login | shift_logout | lunch_login | Lunch_logout | rest_login | Rest_logout |
aaaaa | . | . | . | . | 8:56 | 17:30 |
aaaaa | . | . | 8:56 | 17:30 | . | . |
aaaaa | 8:56 | 17:30 | . | . | . | . |
bbbbb | . | . | . | . | 8:56 | 17:30 |
bbbbb | . | . | 8:56 | 17:30 | . | . |
bbbbb | 8:56 | 17:30 | . | . | . | . |
WANT...
ID | shift_login | shift_logout | lunch_login | Lunch_logout | rest_login | Rest_logout |
aaaaa | 8:56 | 17:30 | 8:56 | 17:30 | 8:56 | 17:30 |
bbbbb | 8:56 | 17:30 | 8:56 | 17:30 | 8:56 | 17:30 |
Do like this
data have;
input ID$ (shift_login shift_logout lunch_login Lunch_logout rest_login Rest_logout)(:time5.);
format shift_login shift_logout lunch_login Lunch_logout rest_login Rest_logout time5.;
datalines;
aaaaa . . . . 8:56 17:30
aaaaa . . 8:56 17:30 . .
aaaaa 8:56 17:30 . . . .
bbbbb . . . . 8:56 17:30
bbbbb . . 8:56 17:30 . .
bbbbb 8:56 17:30 . . . .
;
proc sort data=have;
by ID;
run;
data want;
update have(obs=0) have;
by ID;
run;
Do like this
data have;
input ID$ (shift_login shift_logout lunch_login Lunch_logout rest_login Rest_logout)(:time5.);
format shift_login shift_logout lunch_login Lunch_logout rest_login Rest_logout time5.;
datalines;
aaaaa . . . . 8:56 17:30
aaaaa . . 8:56 17:30 . .
aaaaa 8:56 17:30 . . . .
bbbbb . . . . 8:56 17:30
bbbbb . . 8:56 17:30 . .
bbbbb 8:56 17:30 . . . .
;
proc sort data=have;
by ID;
run;
data want;
update have(obs=0) have;
by ID;
run;
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.