BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jabjolsen
Calcite | Level 5

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
ballardw
Super User

@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.

View solution in original post

2 REPLIES 2
ballardw
Super User

@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
Calcite | Level 5
Thanks a lot for a good answer.! I will check if it works soon.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1869 views
  • 0 likes
  • 2 in conversation