/*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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.