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 ;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1014 views
  • 1 like
  • 4 in conversation