AdministratorFebruary 7, 2021 at 4:31 pm
CALL MISSING Routine
Assigns missing values to the specified character
or numeric variables.
specifies the name of SAS character or numeric variables.
The CALL MISSING routine assigns an ordinary numeric missing value (.) to each numeric variable in the argument list.
The CALL MISSING routine assigns a character missing value (a blank) to each character variable in the argument list. If the current length of the character variable equals the maximum length, the current length is not changed. Otherwise, the current length is set to 1.
You can mix character and numeric variables in the argument list.
The MISSING function checks whether the argument has a missing value but does not change the value of the argument.
call missing(prod, invty);
put prod= invty= sales=;
call missing(of _all_ );
put prod= invty= sales=;
The above code set the specified variables to missing values, including both numeric and char variables.
- This reply was modified 7 months, 1 week ago by Justin.
AdministratorFebruary 7, 2021 at 4:23 pm
It is used to check if the value of a variable is null or missing, it can apply to both numeric and character variables. We know, in SAS, we use “.” for the missing values in numeric variables, and blank for character variables. However, you can go ahead to use MISSING() any variable, do NOT need to think about the data type at all. In addition, if your data contains special missing values, you must use MISSING function, because other methods cannot identify them at all.
MISSING= System Option
Specifies the character to print for missing numeric values.
specifies the value to be printed. The value can be any character such as ‘/’, ‘-‘, ‘ ‘, ‘0’ etc. Single or double quotation marks are optional. Please note: the MISSING= system option does not apply to special missing values such as .A and .Z.
Assigns characters in your input data to represent special missing values for numeric data.
The MISSING statement usually appears within a DATA step, but it is global in scope.
The MISSING= system option allows you to specify a character to be printed when numeric variables contain ordinary missing values (.). If your data contain characters that represent special missing values, such as a or z , do not use the MISSING= option to define them; simply define these values in
a MISSING statement.
With survey data, you might want to identify certain types of missing data. For example, in the data, an A can mean that the respondent is not at home at the time of the survey; an R can mean that the respondent refused to answer. Use the MISSING statement to identify to SAS that the values A and R
in the input data lines are to be considered special missing values rather than invalid numeric data values:
missing a r;
input id answer;
The resulting data set SURVEY contains exactly the values that are coded in the input data.
The following example uses data from a marketing research company. Five testers were hired to test five different products for ease of use and effectiveness. If a tester was absent, there is no rating to report, and the value is recorded with an X for “absent.” If the tester was unable to test the product adequately, there is no rating, and the value is recorded with an I for “incomplete test.” The following program reads the data and displays the resulting SAS data set. Note the special missing values in the first and third data lines:
missing X I;
input Id $4. Foodpr1 Foodpr2 Foodpr3 Coffeem1 Coffeem2;
1001 115 45 65 I 78
1002 86 27 55 72 86
1004 93 52 X 76 88
1015 73 35 43 112 108
1027 101 127 39 76 79
proc print data=period_a;
title 'Results of Test Period A';
footnote1 'X indicates TESTER ABSENT';
footnote2 'I indicates TEST WAS INCOMPLETE';
Log in to reply.