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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.