Calcite | Level 5

## How to calculate a total score taken into account a given amount of missing data.

Hey.

I am a new user of SAS enterprise guide and are doing calculations on forgotten joint score (FJS), which consists of 12 questions, each with a score of 0-4. This makes it possible to score between 0-48 which is converted to a scale from 0-100 by dividing with the number of answered questions and multiplied by 25.

Example with a person scoring 40 points after completing 10 questions (i.e. 2 missing data): (40 point/(12-2))*25=100

Example with a person scoring 38 points after completing same number                                 (38points/(12-2))*25=95

My data consists of approximately 500 patients with different amount of missing data. In the score it is allowed to have missing data of up to 4 questions but not more than this.

I have already made my list with the patients who have a maximum of 4 missing data.

My question is: How do I make the sas-program which calculates the score depending on the number of missing data. Hence the examples above it has to divide by 12 minus the number of missing data in the equation.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: How to calculate a total score taken into account a given amount of missing data.

@Jabjolsen wrote:

Hey.

I am a new user of SAS enterprise guide and are doing calculations on forgotten joint score (FJS), which consists of 12 questions, each with a score of 0-4. This makes it possible to score between 0-48 which is converted to a scale from 0-100 by dividing with the number of answered questions and multiplied by 25.

Example with a person scoring 40 points after completing 10 questions (i.e. 2 missing data): (40 point/(12-2))*25=100

Example with a person scoring 38 points after completing same number                                 (38points/(12-2))*25=95

My data consists of approximately 500 patients with different amount of missing data. In the score it is allowed to have missing data of up to 4 questions but not more than this.

I have already made my list with the patients who have a maximum of 4 missing data.

My question is: How do I make the sas-program which calculates the score depending on the number of missing data. Hence the examples above it has to divide by 12 minus the number of missing data in the equation.

Summary functions to the rescue

I think something similar to this is what you are looking for:

```data want;
set have;
array s score1-score12;
if nmiss(of s(*)) le 4 then
fjs = ( sum(of s(*)) / n(of s(*)) )*25;
run;
```

Score1 to score12 would be replaced by your question variables.

The NMISS function counts missing, the SUM function adds, and the N function counts non-missing.

The " of s(*) " says to use all of the elements of the array when calculating.

2 REPLIES 2
Super User

## Re: How to calculate a total score taken into account a given amount of missing data.

@Jabjolsen wrote:

Hey.

I am a new user of SAS enterprise guide and are doing calculations on forgotten joint score (FJS), which consists of 12 questions, each with a score of 0-4. This makes it possible to score between 0-48 which is converted to a scale from 0-100 by dividing with the number of answered questions and multiplied by 25.

Example with a person scoring 40 points after completing 10 questions (i.e. 2 missing data): (40 point/(12-2))*25=100

Example with a person scoring 38 points after completing same number                                 (38points/(12-2))*25=95

My data consists of approximately 500 patients with different amount of missing data. In the score it is allowed to have missing data of up to 4 questions but not more than this.

I have already made my list with the patients who have a maximum of 4 missing data.

My question is: How do I make the sas-program which calculates the score depending on the number of missing data. Hence the examples above it has to divide by 12 minus the number of missing data in the equation.

Summary functions to the rescue

I think something similar to this is what you are looking for:

```data want;
set have;
array s score1-score12;
if nmiss(of s(*)) le 4 then
fjs = ( sum(of s(*)) / n(of s(*)) )*25;
run;
```

Score1 to score12 would be replaced by your question variables.

The NMISS function counts missing, the SUM function adds, and the N function counts non-missing.

The " of s(*) " says to use all of the elements of the array when calculating.

Calcite | Level 5

## Re: How to calculate a total score taken into account a given amount of missing data.

Thanks a lot for a good answer.! I will check if it works soon.
Discussion stats
• 2 replies
• 1995 views
• 0 likes
• 2 in conversation