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
data want;
set a;
where not missing(total);
run;
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
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 ;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.