Hi SAS experts, could you tell me what is the problem? because the merge didn't work.Thanks for any help.
Hello @art_srap
Most of us will not click on a link such as the one you provide. Please post data, code and your SAS log as text by pasting it into the window that appears when you click on the </> icon. This helps keep formatting correct and readable.
ok, thank you.
Hi SAS experts, could you tell me what is the problem? because the merge didn't work.Thanks for any help.
data DTC1;
input ID EVENT: $11. AESTDTC: $16.;
format AESTDTC1 yymmdd10.;
AESTDTC1=input(AESTDTC,yymmdd10.);
keep ID EVENT AESTDTC1;
datalines;
102 Vomit 2016-01-12T16:05
102 Headache 2016-01-19
103 Severepain 2016-02-17
102 Migraine 2016-02-18T02:00
103 Nausea 2016-02-19
;
proc sort data=DTC1;
by ID;
run;
data DTC2;
input ID RFSTDTC: $10.;
datalines;
102 2016-01-20
104 2016-01-05
103 2016-02-05
;
proc sort data=DTC1;
by ID;
run;
proc sort data=DTC2;
by ID;
run;
Data DTC3;
merge DTC1 DTC2;
by ID;
run;
The merge works as it should and below what it returns. If this is not what you want then please explain what you're after and where below results differs.
Thanks for the reply.
I haven't the last variable in output data https://prnt.sc/rxscbf, but now I now notice in proc print it appears
in log everything is ok, but the output is wrong.
data DTC1;
input ID EVENT: $11. AESTDTC: $16.;
format AESTDTC1 yymmdd10.;
AESTDTC1=input(AESTDTC,yymmdd10.);
keep ID EVENT AESTDTC1;
datalines;
102 Vomit 2016-01-12T16:05
102 Headache 2016-01-19
103 Severepain 2016-02-17
102 Migraine 2016-02-18T02:00
103 Nausea 2016-02-19
;
proc sort data=DTC1;
by ID;
run;
data DTC2;
input ID RFSTDTC: $10.;
datalines;
102 2016-01-20
104 2016-01-05
103 2016-02-05
;
proc sort data=DTC1;
by ID;
run;
proc sort data=DTC2;
by ID;
run;
Data DTC3;
merge DTC1 DTC2;
by ID;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.