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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.