BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
MarkusWeick
Barite | Level 11

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

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles
1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

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;

image.pngimage.png

View solution in original post

5 REPLIES 5
ballardw
Super User

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


 

MarkusWeick
Barite | Level 11

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

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles
ballardw
Super User

@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.

PaulCanals
Obsidian | Level 7

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. 

data_null__
Jade | Level 19

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;

image.pngimage.png

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 556 views
  • 4 likes
  • 4 in conversation