What is the missing function?
What this article shares with you is about what the missing function is. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
The missing () function is a function used to test missing values.
There is an example in the help documentation that checks for variables that contain missing values:
Data _ null_; input @ 1 var1 3. @ 5 var2 3; if missing (var1) then do; put 'Variable 1 is Missing.'; end; else if missing (var2) then do; put' Variable 2 is Missing.'; end; datalines;127988 195
In addition, we often encounter situations where missing values need to be eliminated, and we are usually used to using if variable=. The statement then delete; is prone to error in many cases.
For example:
Data value; input var1 var2 @ @; if var2=. Then delete; datalines;127 988 195. 122. N; run
If var2=. Results such as then delete will only eliminate missing values. The results obtained are:
Obs var1 var2
1 127 988
2 122 N
If we need to eliminate .n, we can consider the missing () function:
Data value; input var1 var2 @ @; if missing (var2) then delete; datalines;127 988 195. 122. N; run;proc print; run
Results:
Obs var1 var2
1 127 988
The above is what the missing function is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.