Help using Base SAS procedures

Merge data with a variable of different length

Accepted Solution Solved
Reply
Regular Contributor
Posts: 161
Accepted Solution

Merge data with a variable of different length

Hi, everyone: 

I hope to merge 10 datasets into one by using the following:

data want;

     set x1 - x10;

run;

But SAS reports that "Multiple lengths were specified for the variable case_no by input  data set(s). This may cause truncation of data."  Could you please tell me how to specify the length in for want dataset so that when I combine small datasets x1 - x10, there is no truncation? 


Thank you!


Accepted Solutions
Solution
‎06-07-2013 02:05 PM
Respected Advisor
Posts: 4,641

Re: Merge data with a variable of different length

Simply state a length for case_no that is as large as the largest one :

data want;

length case_no $30;

set x1-x10;

run;

PG

PG

View solution in original post


All Replies
Super User
Posts: 5,255

Re: Merge data with a variable of different length

First figure out how long case_no is when it's "longest". Then insert a length or an attrib statement prior to the set.

Data never sleeps
Regular Contributor
Posts: 161

Re: Merge data with a variable of different length

Thank you for your help.  It works Smiley Happy

Solution
‎06-07-2013 02:05 PM
Respected Advisor
Posts: 4,641

Re: Merge data with a variable of different length

Simply state a length for case_no that is as large as the largest one :

data want;

length case_no $30;

set x1-x10;

run;

PG

PG
☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 187 views
  • 3 likes
  • 3 in conversation