BookmarkSubscribeRSS Feed
akshayn951
Calcite | Level 5

Hello,

         I used following code for appending multiple datasets in macro code %Do loop.

Proc Append base= DataJoin data= ABC_join&i force; run;

 

where i = 1 to n 

but I'm getting warnings like

"Variable XYZ has different lengths on BASE and DATA files (BASE 16 DATA 15)."

 

I used force option.

also used option varlenchk=nowarn; in code but still it is showing same warnings

any other way is there to avoid these warnings?

 

Thanks.

3 REPLIES 3
SASKiwi
PROC Star

Why do you want to avoid the warnings? They are there for a reason and can alert you to possible data truncation.

ChrisNZ
Tourmaline | Level 20

Make the variables the correct length to avoid that very valid warning.

ballardw
Super User

Would I be correct in assuming that your data= ABC_join&i data sets are coming from Proc Import?

Proc Import makes assumptions as to variable type and length for each data set created and so has no guarantee that the lengths or even types of the same named variables will be the same.

 

Best is to read the data in the proper form at the outset.

Second, and tedious, is to have a step "adjust" things.

Third, how do you know that the length of the variable assigned in the Base data set is correct, i.e. long enough to hold the longest valid value?

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 969 views
  • 4 likes
  • 4 in conversation