Hello,
I am trying to combine two dataset - one from REDCap that has disease information, one from an access database that contains what clinic they were found in.
Here is the code I have and the error message I am getting:
options MSGLEVEL=I
proc sort data=redcap; by id; run;
proc sort data=octri; by ID; run;
**Merge both datasets into one excel**;
data enrollments;
merge redcap (in=a) octri (in=b);
by ID;
if a;
run;
proc print data=enrollments;
Title 'Biobank Enrollments';
run;
Error message:
46784 proc sort data=redcap; by id; run;
----
13
ERROR 13-12: Unrecognized SAS option name SORT.
46784! proc sort data=redcap; by id; run;
----
13
ERROR 13-12: Unrecognized SAS option name DATA.
46785 proc sort data=octri; by ID; run;
NOTE: There were 848 observations read from the data set WORK.OCTRI.
NOTE: SAS sort was used.
NOTE: The data set WORK.OCTRI has 848 observations and 73 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.21 seconds
cpu time 0.01 seconds
46786
46787 **Merge both datasets into one excel**;
46788
46789 data enrollments;
46790 merge redcap (in=a) octri (in=b);
ERROR: Variable sex has been defined as both character and numeric.
46791 by ID;
46792 if a;
46793 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ENROLLMENTS may be incomplete. When this step was stopped there
were 0 observations and 2653 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
46794
46795 proc print data=enrollments;
46796 Title 'Biobank Enrollments';
46797 run;
NOTE: No observations in data set WORK.ENROLLMENTS.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
Thanks in advance.
Please examine your code very very carefully. You are missing a semi-colon.
If you get "weird" error messages like here where SAS tells you about some unrecognized OPTION name sort where you know that SORT in your code isn't an option but a Procedure: Check for missing semicolons prior to the line of code where the error gets thrown.
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.