How can I use the CMISS function in SAS? Can you provide an example? 2

How can I use the CMISS function in SAS? Can you provide an example?

The CMISS function in SAS is a useful tool for identifying missing values in a dataset. It can be used to count the number of missing values in a specific variable or in an entire dataset. To use the CMISS function, the user must specify the variables or columns to be checked for missing values. If a missing value is found, it will be counted in the result. An example of using the CMISS function in SAS would be to count the number of missing values in a dataset containing information on customer orders. This would help to identify any incomplete or inaccurate data that may need to be addressed.

Use the CMISS Function in SAS (With Example)


You can use the CMISS function in SAS to count the number of missing values in each row of a dataset.

Here is one common way to use this function in practice:

data new_data;
    set my_data;
    total_missing = cmiss(of team -- assists);
run;

This particular example creates a new dataset called new_data that includes a column called total_missing that counts the number of missing values in each row between the columns named team and assists.

The following example shows how to use this syntax in practice.

Example: Use CMISS in SAS to Count Number of Missing Values in Each Row

Suppose we have the following dataset in SAS called my_data that contains information about various basketball players:

/*create dataset*/
data my_data;
    input team $ points assists;
    datalines;
Cavs 12 5
Cavs 14 7
Warriors 15 9
. 18 9
Mavs 31 7
Mavs . 5
. . 3
Celtics 36 9
Celtics 40 7
;
run;

/*view dataset*/
proc printdata=my_data;

Notice that several rows have missing values.

We can use the CMISS function to count the number of missing values in each row:

The following examples show how to use each method in practice with the following dataset in SAS:

/*create new dataset that counts number of missing values in each row*/data new_data;
    set my_data;
    total_missing = cmiss(of team -- assists);
run;

CMISS function in SAS

The new column called total_missing displays the number of missing values in each row.

For example:

  • The first row contains 0 missing values.
  • The second row contains 0 missing values.
  • The third row contains 0 missing values.
  • The fourth row contains 1 missing value.

Note: You can find the complete documentation for the SAS CMISS function .

The following tutorials explain how to perform other common tasks in SAS:

Cite this article

stats writer (2024). How can I use the CMISS function in SAS? Can you provide an example?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-cmiss-function-in-sas-can-you-provide-an-example/

stats writer. "How can I use the CMISS function in SAS? Can you provide an example?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-cmiss-function-in-sas-can-you-provide-an-example/.

stats writer. "How can I use the CMISS function in SAS? Can you provide an example?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-cmiss-function-in-sas-can-you-provide-an-example/.

stats writer (2024) 'How can I use the CMISS function in SAS? Can you provide an example?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-cmiss-function-in-sas-can-you-provide-an-example/.

[1] stats writer, "How can I use the CMISS function in SAS? Can you provide an example?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use the CMISS function in SAS? Can you provide an example?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
PDF
Scroll to Top