When submitting, please prepare the data steps written in datalines so that we can easily process the data.
The following is an example of processing.
data have;
infile datalines dsd;
length subj recrd 8 dvact $20;
input subj recrd dvact $;
datalines;
101,1,action taken
101,2,withdraw from study
101,2,other
101,3,IRB given
101,4,Site reinstructed
101,5,subject counselled
101,5,other
;
run;
proc sql;
create table dv as
select * , count(*) as cnt
from have
group by subj, recrd
;
update dv set dvact='MULTIPLE' where cnt>1;
create table supp_dv as
select *
from have
group by subj, recrd
having count(*)>1
;
quit;
proc sort data=dv(drop=cnt) nodupkey;
by subj recrd;
run;
data supp_dv;
set supp_dv;
length qlabel $40;
rename dvact=qval;
qlabel='Multiple actions X';/*what's 2 or 3 means you describe?*/
run;
The above is handled in sql mainly, but if you are not good at sql, you can count the number of records in the data step using the retain statement, first. variable. Once you know the number of records, all you have to do is create two datasets. Do a little research on your own.
... View more