Help using Base SAS procedures

column header truncated if it more than 32 char long when I use Proc export

Reply
Frequent Contributor
Frequent Contributor
Posts: 81

column header truncated if it more than 32 char long when I use Proc export

Hi
When I run below coding , the column header is truncated to 'this is testing more than thirty' but my acutal column header is 'this is testing more than thirty two charaters'. Can any one help to fix this problem.

Thanks so much for your help in advance.



data temp;
input x $50.;
label x = 'this is testing more than thirty two charaters';
cards;
aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee
;
proc print data=temp label;
run;

PROC EXPORT DATA=temp
OUTFILE='C:\PROJECTS\TPA_Current\OCT2009\testing.csv'
DBMS=csv
REPLACE LABEL;
RUN;
Super User
Posts: 5,257

Re: column header truncated if it more than 32 char long when I use Proc export

I got the same result.
Can't find any limitation mentioned in the documentation, so you could open a track to SAS support for clarification.
To fix this, you probably have to do some data step programming instead.
/Linus
Data never sleeps
Super Contributor
Super Contributor
Posts: 3,174

Re: column header truncated if it more than 32 char long when I use Proc export

It appears that PROC EXPORT still uses the SAS v7 (then current) max label text length. Oddly, the LABEL option was just added with SAS v9.2, I believe.

You may also notice in the SAS DOC for EXPORT that any SAS variable that is longer than 32 characters is also truncated (without the LABEL parameter of course). Likely doesn't sound like it will be considered a DEFECT, given this condition.

Regardless, it's important to contact SAS support to give them the feedback on these types of limitations rather than presuming they already know.

Scott Barry
SBBWorks, Inc.
SAS Super FREQ
Posts: 8,743

Re: column header truncated if it more than 32 char long when I use Proc export

Hi:
One possible workaround is to use ODS CSV, as shown below.
cynthia
[pre]
data temp;
length x y $50;
input x $;
y='twas brillig and the slithy toves';
label x = 'this is testing more than thirty two characters'
y= 'Not as long for the label';
cards;
aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee
;
run;

ods listing close;
ods csv file='c:\temp\longlabel.csv';

proc print data=temp label;
run;
ods csv close;
[/pre]
Ask a Question
Discussion stats
  • 3 replies
  • 1003 views
  • 0 likes
  • 4 in conversation