/*Append all table*/ data spay.contactless; set usage transactions active ratio; run;
all the 5 tables above has a variable _NAME_. However when I append them by row as above, the variable _NAME_ has truncated values.
How can I redefine the length for _NAME_?
Or how can I create another variable as below?
/*Combine for Contactless Table*/ data spay.contactless; input new_NAME_ $20; set spay.usage spay.transactions spay.active spay.ratio; new_NAME_ = _NAME_; *copy _NAME_ to new_NAME_; run;
SImplest:
/*Append all table*/ data spay.contactless;
length _name_ $20; set usage transactions active ratio; run;
Just make sure the LENGTH statement appears before the SET statement.
SImplest:
/*Append all table*/ data spay.contactless;
length _name_ $20; set usage transactions active ratio; run;
Just make sure the LENGTH statement appears before the SET statement.
_NAME_ is a SAS internal variable name which you get from, for example, a transpose output. Why would you want to be using this further, use your own variables or you might encounter problems later on. Also, why do you have several sets of the same data which need to be put back together? If your data is in one dataset - and we have discussed this in one of your other posts - then this question no longer exists. Your basically just creating blocks of work for yourself needlessly.
If you had read the log after running the step combining the sets you would have seen this message:
WARNING: Multiple lengths were specified for the variable _NAME_ by input data set(s). This may cause
truncation of data.
Which tells you what the cause was.
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!
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.