BookmarkSubscribeRSS Feed
grhyne
Calcite | Level 5

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. 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Please examine your code very very carefully. You are missing a semi-colon.

--
Paige Miller
Patrick
Opal | Level 21

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.

Patrick_0-1696383560044.png

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 530 views
  • 0 likes
  • 3 in conversation