Help using Base SAS procedures

Merge

Accepted Solution Solved
Reply
Contributor
Posts: 72
Accepted Solution

Merge

while merging data i got following error, can anyone look at it and tell me how to deal with it. 

 

Screenshot 2016-12-07 11.04.11.png


Accepted Solutions
Solution
‎12-07-2016 01:42 AM
Super User
Posts: 5,071

Re: Merge

This message is telling you that COMPANY is part of both data sets that you are merging.  However, it has a different length in the two data sets.  You would need to examine the length (probably running  PROC CONTENTS on both data sets), select the longer length, and use that to define COMPANY.  You would do that by adding this sort of statement (using the longer length rather than 20):

 

length company $ 20;

 

It has to go BEFORE the MERGE statement.

View solution in original post


All Replies
Solution
‎12-07-2016 01:42 AM
Super User
Posts: 5,071

Re: Merge

This message is telling you that COMPANY is part of both data sets that you are merging.  However, it has a different length in the two data sets.  You would need to examine the length (probably running  PROC CONTENTS on both data sets), select the longer length, and use that to define COMPANY.  You would do that by adding this sort of statement (using the longer length rather than 20):

 

length company $ 20;

 

It has to go BEFORE the MERGE statement.

Valued Guide
Posts: 797

Re: Merge

Or if the first dataset in the merge statement (E1 in your case) has company with the longer length, it will prevail.

 

In general the first encounter with a variable establishes its attributes (length, format, label), while the last encounter establishes the value.

 

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 266 views
  • 3 likes
  • 3 in conversation