Hello
I am using SAS 9.1. I have a hospital data set where one abstract is one row of data.
I was able to figure out how to extract the multi-occurring fields like diagnosis or procedure using the following:
DATA have;
set mylib.data_2011;
keep chartno acctno sepdate diagcde1-diagcde25;
RUN;
proc sort data=have out=have_sort;
by acctno chartno;
run;
proc transpose data=have_sort out=need(rename=col1=dxcode);
by acctno chartno sepdate;
var diagcde1-diagcde25;
run;
data Dx_List;
set need;
format sepdate ddmmyy10.;
where dxcode ne "";
run;
With hospital there are 25 possible diagnoses that could be coded but not every patient will have 25 diagnoses but in the transpose step it assigns diagcde1-diagcde25 for all cases. My last step for Dx_List is to remove the blanks and everything is working well.
But how do I introduce other variables? For instance, I want to also include diagtyp, diagpre, and diagclust which all also have 25 possible entries.
Also, for the code above, it creates a column called "Name of Former Variable" which lists diagcde1-diagcde25 - how do I change that field? For instance, I would like it to show as occurrence number instead of this text field. In other words take out the diagcde portion of the field to leave the #.
Any and all assistance greatly appreciated - thanks.