/***************************************************************************************** Pain_t_score.sas Purpose: Code assigning a PROMIS Pain Interference T score to each MHOS. PROMIS Pain Interference items asked on MHOS survey starting from 2013 (HOS 2.5): PAINDACT: In the past 7 days, how much did pain interfere with your day to day activities? PAINSACT: In the past 7 days, how often did pain keep you from socializing with others? Input: 1. Your input dataset 2. Excel file including variables PAINDACT, PAINSACT, and PAIN_T_SCORE. Note: No T scores will be assigned if the values for one or both items are missing. *****************************************************************************************/ *Read in the Excel file with the T scores*; proc import out=pain_t_score datafile="pain_t_score.xlsx" dbms=xlsx replace; getnames=yes; run; *Sort the input data by variables PAINDACT and PAINSACT*; proc sort data=input; by paindact painsact ; run; *Merge the input data with the T score file on PAINDACT+PAINSACT to obtain the T scores*; data input; merge input(in=a) pain_t_score(in=b); by paindact painsact; if a; run;