ods graphics on;
*****************************************************************************************
*  Program Name      : ordalpha.sas
*
*  Purpose of Code  : ordinal alpha reliability
*
*  Author/Date      : Modified by RH and KS, Dec 11 2015.
*  Based on Laura Ring Kapitula, Estimating ordinal reliability using SAS,
*  Paper 2042-2014.
http://www.sascommunity.org/wiki/Estimating_Ordinal_Reliability_Using_SAS%C2%AE
*
*  Required edits include: dsname (and data), workdir, and progname.
*  Within datastep that sets up processing, be sure to name your items from q1 up,
*  and set the nitems value.
****************************************************************************************;
%let progname=ordalph_setup;
%let workdir=C:\projects\CAHPS_MC\PSC\ordinal_reliability;
libname mydata "&workdir";

/* always output supporting file */
ods pdf file="&workdir\&progname..pdf";
footnote2 "Program Name: &progname..sas on %sysfunc(today(),mmddyy10.)
%sysfunc(time(),time.)";
*************************************************************;
** rename items to q1-q.. and set nitems and ds(name);
*************************************************************;
DATA pfdata;
SET mydata.pfdata;
rename
BATHING1  = q1
DRESSING1 = q2
EATING1  = q3
CHAIRS1  = q4
WALKING1  = q5
TOILET1  = q6;
%let nitems=6;  * number of items;
%let ds=pfdata; * datasetname;
RUN;
*************************************************************;
** no changes beyond this point;
%include "&workdir\ordalpha.mac" /nosource;
*options macrogen mprint mlogic symbolgen;
%ordalph(ds=&ds,items=q1-q&nitems);