I know there must be a way to loop through a datastep using 1 variable with multiple categories but I can't figure it out how. If someone could help me out that would be great.
I want to repeat the data step below using all of the different categories within the variable "Priority"
The control should stay priority = 2
But I want the case persons to loop through the other categories = 1, 3, 4, 5 so that I get 4 different Odds Ratios
proc format;
VALUE CC
1 = "CONTROL"
2 = "CASE"
3 = "EXPOSURE+"
4 = "EXPOSURE-";
run;
%LET EXPOSURE = NRT ;
DATA want;
SET have;
/* CONTROL PERSON = WHITE FORMER SMOKER*/
IF PRIORITY = 2 AND SMOKE=4 THEN CCGROUP = 1;
/* CASE PERSON = INDV PRIORITY GROUP + CURRENT SMOKER*/
IF PRIORITY = 5 AND SMOKE=5 THEN CCGROUP = 2;
/* EXPOSURE (+) YES USED NRT*/
IF &EXPOSURE = 1 THEN CCGROUP = 3;
/* EXPOSURE (-) DID NOT USE NRT */
IF &EXPOSURE = 2 THEN CCGROUP= 4;
FORMAT CCGROUP CC. ;
RUN;
PROC FREQ DATA= COMPARISONGROUPS ORDER=FREQ;
TABLES CCGROUP*EXP / OR;
RUN;