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.
@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.
@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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.