I am using proc transpose to change the table from wide to long. But in the column "old-column" the old some variable names are truncated. What can I do, to get them in the original length?
proc transpose data=have
name =old_column
out=want
by column_to_keep;
run;
Thanks,
Markus
It appears the default is $8 or the length of the longest name greater than $8
proc transpose data=sashelp.class(obs=0 keep=sex) out=want;
var _all_;
run;
proc contents varnum;
run;
proc transpose data=sashelp.class(obs=0 rename=(name=name5678910)) out=want2;
var _all_;
run;
proc contents varnum;
run;
Can you provide an example data set that exhibits this behavior?
Note that your code as posted will not run as the semicolon between the Proc statement and the BY statement is missing.
@MarkusWeick wrote:
I am using proc transpose to change the table from wide to long. But in the column "old-column" the old some variable names are truncated. What can I do, to get them in the original length?
proc transpose data=have name =old_column out=want by column_to_keep; run;
Thanks,
Markus
Hi @ballardw, Thanks, and sorry for my badly prepared question. Next time I will do an example set before asking. (I found that the truncating was done later in proc append with forve option).
Thanks again,
Markus
@MarkusWeick wrote:
Hi @ballardw, Thanks, and sorry for my badly prepared question. Next time I will do an example set before asking. (I found that the truncating was done later in proc append with forve option).
Thanks again,
Markus
I suspected it might be something along those lines. Proc Transpose is pretty mature and would be surprised to see that as the cause of the _name_ truncation.
The Proc Transpose procedure takes care of the naming lengths and works very well.
A real problem is using the force option (in combination with nowarn option) in the Proc Append procedure.
It appears the default is $8 or the length of the longest name greater than $8
proc transpose data=sashelp.class(obs=0 keep=sex) out=want;
var _all_;
run;
proc contents varnum;
run;
proc transpose data=sashelp.class(obs=0 rename=(name=name5678910)) out=want2;
var _all_;
run;
proc contents varnum;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.