I am trying to combine the two datasets below. I am also adding formats so that they can be combined. I want the final dataset (WORK.AllSites) to look like this: Institution SubjID Name SexCd 1 City Medics 102 Wilson, Steven M 2 City Medics 105 Moore, Chris M 3 City Medics 109 Jackson, Sharon F 4 St John’s 203 Taylor, Daniel M 5 St John’s 206 Davis, Helen F 6 St John’s 208 Smith, Betty F When I combine them together the code does not work and I only get the CM data imported. What can I do to fix this? data WORK.CM; infile datalines delimiter = ':'; input Institution :$11. SubjID :3. Name :$15. Gender :$6.; datalines; City Medics:102:Wilson, Steven:Male City Medics:105:Moore, Christ:male City Medics:109:Jackson, Sharon:Female ; data WORK.StJohns; infile datalines delimited = ','; input Site :$9. PatientID :3. FirstNm :$6. LastNm :$6. Sex :$1.; datalines; St John's,203,Daniel, Taylor,M St John's,206,Helen, Davis,F St John's,208,Betty, Smith,f ; data WORK.AllSites; set WORK.StJohns; SexCd1=propcase(Sex); rename Site = Institution PatientID = SubjID SexCd1 = SexCd; Name = catx(',', LastNm, FirstNm); run; data WORK.AllSites; set WORK.CM; SexCd = propcase(substr(Gender, 1, 1)); run; data WORK.AllSites; set WORK.StJohns WORK.CM; keep Institution SubjID Name SexCd; run; proc sort data = WORK.AllSites; by Institution SubjID; run;
... View more