Proc Print Truncation issue

Reply
N/A
Posts: 0

Proc Print Truncation issue

I'm getting the error message 'Data too long...truncated to 94 characters to fit' and in my output, the sentence for the variable "COMMENT" is getting cut off and the entire paragraph is not showing. How do I increase the number of characters allowed in proc print so that I can see the entire entry, no matter how long the data are?

thanks!!!
SAS Super FREQ
Posts: 8,642

Re: Proc Print Truncation issue

Hi:
Here's one note that describes that message in conjunction with PROC IMPORT followed by a PROC PRINT:
http://support.sas.com/kb/5/492.html

However, I can duplicate that error message by just setting a small linesize for my session or job. Consider this program that makes a BIG variable called NEWNAME -- it is a length of 259 characters -- 8 for name, plus ':', plus a long string of '1234Z' :

[pre]
data biglines;
set sashelp.class;
length newname $259 temp $250;
temp = repeat('1234Z',49);
newname = catt(name,':',temp);
run;
[/pre]
Anyway, after I make that big variable, now I want to use PROC PRINT. Notice how I turn on the LISTING window and set a small LINESIZE in this first PROC PRINT:
[pre]
ods listing;
options linesize=64;
proc print data=biglines;
var name age newname;
title 'linesize set to 64';
run;
[/pre]
The note in the log says:

WARNING: Data too long for column "newname"; truncated to 60 characters to fit.


And, I still get an error message after the second PROC PRINT because 259 (the length of NEWNAME) is bigger than the max linesize of 256 that I can set:
[pre]
options linesize=256;
proc print data=biglines;
var name age newname;
title 'linesize set to 256';
run;
[/pre]


WARNING: Data too long for column "newname"; truncated to 252 characters to fit.


However, since ODS HTML ignores linesize, you can use the following code and get your "big" variable displayed in its entirety in the HTML output file.
[pre]
** using ODS;
ods listing close;
ods html file='c:\temp\biglines.html' style=sasweb;
proc print data=biglines;
var name age newname;
title 'Using ODS';
run;

ods html close;
ods listing;
[/pre]

If you have a big variable that is less than 256 characters or if your total linesize is less than 256 characters, you may be able to stop that error message with a simple change to the LINESIZE option. Otherwise, you can switch to ODS HTML in order to avoid the problem. On the other hand, if you are having the first PROC IMPORT related problem, then you may have to apply the service pack described in the Tech Support note.

cynthia
Occasional Contributor
Posts: 5

Re: Proc Print Truncation issue

Hi Cynthia,

 

I still got the same error when I am using ODS HTML without closing ODS Listing.

 

Its must be ODS Listing which is causing the error.

 

Rama

Post a Question
Discussion Stats
  • 2 replies
  • 6185 views
  • 0 likes
  • 3 in conversation