BookmarkSubscribeRSS Feed
Smitha9
Fluorite | Level 6

I want a code which uses phrase "not missing" or something similar to remove the missing values.

Data A:

ID total

1     12

2      .

3     14

4     16

5      .

Data Want:

I want the code with using "not missing"

1   12

3   14

4   16

 

 

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26
data want;
    set a;
    where not missing(total);
run;
--
Paige Miller
Smitha9
Fluorite | Level 6

I want a code which uses phrase "not missing" or something similar to code.

Data A:

ID total

1     12

2      .

3     14

4     16

5      .

Data Want:

I want the code 

if "not missing" then fun=1 else fun=0

ID  total   fun

1   12        1

2    .          0

3   14        1

4   16        1

5     .         0

PaigeMiller
Diamond | Level 26

Already answered in your other thread

 

Please do not post the same question twice.

--
Paige Miller
AMSAS
SAS Super FREQ

Go review the documentation on the Missing Function

 

data have ;
	infile cards ;
	input id $ total ;
cards ;
1 12
2 .
3 14
4 16
5 .
;

data want ;
	set have ;
	/* Use the Missing Function */
	/* https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p06ybg84o0asa4n17l9ieauk58hb.htm */
	if not missing(total) then fun=1 ;
	else fun=0 ;
run ;