Hi all, what I have : data WORK.SUPPCM;
infile datalines dsd truncover;
input USUBJID $ 1 IDVARVAL $ 3-4 QNAM $ 6-9 QVAL :$200.;
label USUBJID="Unique Subject Identifier" IDVARVAL="Identifying Variable Value" QNAM="Qualifier Variable Name" QVAL="Data Value";
datalines;
a 1 ATC AAA
a 1 ATC3 BBB
a 10 ATC OLISM
a 10 ATC3 GASTRO
a 11 ATC CSYSTEM
a 11 ATC3 SFFECTS
a 12 ATC VARIOUS
a 13 ATC ALISM
a 13 ATC3 DRESOPHAGERD
a 2 ATC ANTNTS
a 2 ATC3 ANTIMES
a 3 ATC ANTINEOPLLATING AGENTS
a 3 ATC3 OTHASTS
a 4 ATC ANTINGENTS
a 4 ATC3 ANTIMITES
a 5 ATC CARDEM
b 1 ATC FF
b 1 ATC3 DDFAS
b 10 ATC OLIFASFSM
b 10 ATC3 GASFTRO
b 11 ATC CSYASTEM
b 11 ATC3 SFFSDECTS
b 12 ATC VAFRIOUS
b 13 ATC ALISM
b 13 ATC3 DRFESOPHAGERD
b 14 ATC ALIFSM
b 14 ATC3 DRFDESOPHAGERD
b 2 ATC ANTNSDFTS
b 2 ATC3 ANTIMES
b 3 ATC ANTINEOPLLATING AGENTS
b 3 ATC3 OTHASDSTS
b 4 ATC ANTIFNGENTS
b 4 ATC3 ANTIMITES
b 5 ATC CARDSDEM
b 5 ATC3 CARDSDEM
b 6 ATC fssdf
b 6 ATC3 FSDFD
;;;;
run;
data WORK.CM;
infile datalines dsd truncover;
input USUBJID $ 1 CMSEQ;
label USUBJID="Unique Subject Identifier" CMSEQ="Sequence Number";
datalines;
a 1
a 2
a 3
a 4
a 5
a 6
a 7
a 8
a 9
a 10
a 11
a 12
a 13
b 1
b 2
b 3
b 4
b 5
b 6
b 7
b 8
b 9
b 10
b 11
b 12
b 13
b 14
b 15
b 16
;;;;
run; and my code is as below: data cm1;
if _n_=1 then do;
dcl hash h();
h.definekey('usubjid','cmseq');
h.definedata('usubjid','cmseq','atc','atc3');
h.definedone();
end;
do until(last.idvarval);
set suppcm;
by usubjid idvarval;
if qnam='ATC' then atc=qval;
if qnam='ATC3' then atc3=qval;
end;
cmseq=input(idvarval,best.);
h.add();
set cm;
call missing(atc,atc3);
rc=h.find();
keep usubjid cmseq atc atc3 ;
run; What puzzled me is that atc and atc3 are all missing when cmseq=2,3,4,5,6,7,8,9. Is something wrong with my code?Please help me. Thanks.
... View more