07-21-2011 09:46 AM
I think this is a simple solution, but I can't seem to figure it out.
I have multiple datasets in the exact same data layout that i'd like to concatenate using the data step.
data merged ;
set table1 table2 table3 table4 ;
A variable may have different lengths in each of the tables so when I run the code above I get the warning:
"Multiple lengths were specified for the variable Product by input data set(s). This may cause truncation of data."
I tried adding the length statement but still got the warning.
How can I set the length so I do not get the warning?
Thanks for your help.
07-21-2011 10:37 AM
My limited testing shows that if you still have the warning it means that one or more of the varables from the input data sets have a length longer than you have defined. You could use PROC CONTENTS and PROC SUMMARY to determine the MAX length of each variable and code gen LENGTH/ATTRIB statements to resolve the issue.
07-21-2011 01:28 PM
Is their a way to force the length for the new dataset?
table1: Product $15
table2: Product $15
table3: Product $17
table4: Product $15
for some reason i have some dirty records in table3 that makes the product variable $17, In my merged dataset I want to make product $15, and its fine if its truncated.
07-21-2011 01:37 PM
You are doing that with the length statement or by ensuring that the culprit is not the first file. Or are you asking how to do it without having to confront the warnings?
Need further help from the community? Please ask a new question.