Hi All,
I'm trying to compare the prevalence of lung function between diabetics and non-diabetics. I have a data set that assigns a GOLD stage (-1 - 4) to each individual. I separated the individuals into yes/no by diabetes status at baseline. I need to write code that then lists the frequency of each stage for each diabetic yes/no (so both yes and no categories will have stages -1 -4).
Here is the earlier code that I wrote to separate individuals by diabetes status yes/no: Works great
proc format;
value diabetes_baseline
0 = 'No'
1 = 'Yes'
other = 'missing';
run;
data temp1;
set temp;
format diabetes_P1 diabetes_baseline.;
run;
Proc freq data = temp1;
tables diabetes_P1;
run;
I know this code is incorrect because I'm using the same stage numbers and giving them different names based on diabetes status. I'm not even certain I should be using an if/then statement, but this is what I have....
proc format;
value DMBaseline_Gold_Stage
-1 = 'Gold Stage -1'
*insert others once this works;
other = 'missing';
run;
proc format;
value Cntrl_Baseline_Gold_Stage
-1 = 'Gold Stage -1'
*insert others once this works;
other = 'missing';
run;
data temp1;
set temp;
where finalgold_P1;
if finalgold_P1 = -1 and diabetes_baseline = 1 then DMBaseline_Gold_Stage = -1;
else if finalgold_P1=-1 and diabetes_baseline = 0 then Cntrl_Baseline_Gold_Stage =-1;
* fill in other stages here once code works;
format DMBaseline_Gold_Stage DMBaseline_Gold_Stage.;
format Cntrl_Baseline_Gold_Stage Cntrl_Baseline_Gold_Stage.;
format diabetes_P1 diabetes_baseline.;
run;
I don't need the new categories of DMBaseline_Gold_stage nor Cntrl_baseline_Gold_stage. I simply want to list the frequency of each gold stage within the yes/no diabetes categories.
Sorry this is so long. Any help is much appreciated.