06-25-2016 07:13 PM
I was asked to develop a SAS code the would rescore catergorical variables based on a peer based comparison. I am not event sure how to approach it. I figured a proc freq needs to be used to figure out the count of obs in each category (FMS, SubP, SomeP, WTR, NA, DNR). Then maybe sort obs into they categories. The attache the category count to that observation so I can use it later in an algorithm. Below are the computation direction I have been given. I just really dont event know where to start. and I haven't found anything online that helps answer this question. Thank you to every generous soul who helps!!!
Score categorical measures in the following manner:
1. Count the number of hospitals scored in each scoring designations
2. Sum the total number of hospitals across all designations excluding the “N/A” scoring category.
3. For each category, divide the number of hospitals with a scoring designation at or below that category, and divide by the sum from Step 2.
4. Multiply the quotient from Step 3 by 100.
5. Round the result to zero decimal places
6. The results from Step 5 become the scores for each of the scoring designations. Those with the highest possible score designation (“Fully Meets Standard”) receive 100 points, and those designated as “Did Not Respond” get 0 points.
A categorical measure has the following hospital counts for each scoring designation
DNR = 50
In this case, the sum of all hospitals excluding the “N/A” designation is 1150.
The score for hospitals with the SubP designation would be the sum of all the hospitals who scored at or below “SubP” (300+200+100+50) divided by 1150. (=650/1150= .5652). Multiplied by 100 and rounded, the score for SubP becomes 57. The same process would be applied in like manner for SomeP and WTR. FMS hospitals would get 100, DNR hospitals would get 0.
07-01-2016 06:45 PM
It isn't obvious to others what "below" may indicate.
My stab would be to create a number of indicator variables that have values of 0 or 1 when they should not be excluded.
Assuming you have a data set of the categorical variables If I understand some what what you are doing they might look like:
data have; input a $ b $ c $; datalines; N/A FMS WTR FMS FMS DNR SubP SomeP DNR SubP N/A WTR SomeP SubP N/A WTR WTR FMS WTR DNR DNR ; run; data want; set have; array cat a b c; /*<list your categorical variables here instead of a b c>;*/ do i = 1 to dim(cat); category= vname(cat[i]); if cat[i] ne 'N/A' then do; IFms = cat[i] in ('FMS','SubP','SomeP','WTR','DNR'); ISubP = cat[i] in ( 'SubP','SomeP','WTR','DNR'); ISomeP = cat[i] in ( 'SomeP','WTR','DNR'); IWTR = cat[i] in ( 'WTR','DNR'); IDNR = cat[i] in ( 'DNR'); end; output; end; run; /* summarize with a report procedure, note: the MEAN of a 0/1 coded variable is Percent if only assigned as needed. specify a PERCENT format to do the *100 and round*/ proc tabulate data=want; class category; var IFms ISubP ISomeP IWTR IDNR; table category, (IFms ISubP ISomeP IWTR IDNR) * mean=''*f=percent8.; run;
You would get nicer output in the final table if your categorical variables had label by 1) making the length of category larger and 2) using the VLABEL function instead of VNAME. Also assigning labels to the indicators would be a good idea.
If you had other variables in your Have data set such as State or City, they could be included in the report from Tabulate as Class variables. Or Proc Report would do similar.
07-05-2016 10:38 AM
Thank you so much for all your help! I greatly appreciate you taking the time and explaining the code!