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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.