From: Trish Bous on
Hi All,

I am trying to use proc append to merge values from 2 different variables.
I am looking at 3 ICD-9 diagnoses per patient and I want to know what is the
most frequent diagnoses, regardless if it is first or second.

I am sure that there is a better way to do this, and I hope someone can help.
Data is like this:
ID PRS1 PRS2
1 862 0000
2 811 862
3 9823 0000
4 862 6211
etc.

My code looks like this:

data tmp1 (keep=prs1);
set z.neoplasm;
run;

data tmp2 (keep=prs2);
set z.neoplasm;
run;

data tmp2;
set tmp2;
rename prs2=prs1;
run;


PROC APPEND BASE=tmp1 DATA=tmp2;
RUN;

proc freq data=tmp1 noprint; tables prs1 / out=t_gb; run;

proc sort data=t_gb ; by descending count; run;

proc print data = t_gb ; run;

Thanks!