Date: Thu, 28 Sep 2006 10:04:02 -0400
Reply-To: Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject: Re: Length function doesn't work (Data too long for column ... tr
uncated)
Content-Type: text/plain; charset="iso-8859-1"
Irin,
While inserting the format statement in the PROC PRINT may eliminate the
Warning messages, it does not get to the issue of why these variable lengths
(or previous formats) are longer than you expected.
If it is the lengths of the variables that are longer than expected, this
can affect performance by carrying more information than needed.
I think it would be a good idea to do a PROC CONTENTS on FLU_SINGLE2 to
determine the lengths of the fields and any associated formats. Then adjust
your code so you aren't carrying excessive data or unnecessary formats.
Jack Clark
Research Analyst
Center for Health Program Development and Management
University of Maryland, Baltimore County
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Irin
later
Sent: Thursday, September 28, 2006 9:42 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Length function doesn't work (Data too long for column ...
truncated)
Thank you very much! I inserted format into proc print and it didn't
generate Warnings anymore!
proc print data=&dsn (obs=20);
format accepts_calls $10.;
format wrong_phone_number $10.;
var enroll startdate enddate accepts_calls wrong_phone_number;
where enroll = "&resp";
title "Printout of &dsn to check enroll variable where enroll=&resp";
run;
"data _null_;" <datanull@GMAIL.COM> wrote:
You don't really show enough of data ORIG code to know but it could be
as simple as the formats are too long not the length. Use proc
contents to verify the meta data for ORIG. Consider the following....
2 options ls=64;
3 proc contents data=sashelp.class varnum;
4 run;
NOTE: PROCEDURE CONTENTS used:
real time 0.03 seconds
cpu time 0.03 seconds
NOTE: The PROCEDURE CONTENTS printed page 1.
5 proc print data=sashelp.class;
6 format name $100.;
7 run;
WARNING: Data too long for column "Name";
truncated to 60 characters to fit.
NOTE: There were 19 observations read from the data set
SASHELP.CLASS.
NOTE: The PROCEDURE PRINT printed page 2.
On 9/28/06, Irin later wrote:
> At the very beginning of my code I set the length of the character data
fields like that:
> data ORIG;
> 593 length asked_question $ 6;
> 594 length response_to_question $ 6;
> 595 length accepts_calls $ 3;
> 596 length wrong_phone_number $ 6;
>
> However after I run the whole code Print data caused a WARNING message
regarding too long data as below:
>
> 656 %macro diag2(dsn,resp);
> 657 proc print data=&dsn (obs=20);
> 658 var shot shotdate questiondate;
> 659 where shot = "&resp";
> 660 title "Printout of &dsn to check shot variable where shot=&resp";
> 661 run;
> 662
> 663 proc print data=&dsn (obs=20);
> 664 var enroll startdate enddate accepts_calls wrong_phone_number;
> 665 where enroll = "&resp";
> 666 title "Printout of &dsn to check enroll variable where enroll=&resp";
> 667 run;
> 668
> 669 %mend;
> 670
> 671 %diag1(flu_single2);
>
>
> WARNING: Data too long for column "accepts_calls"; truncated to 93
characters to fit.
> WARNING: Data too long for column "wrong_phone_number"; truncated to 93
characters to fit.
> NOTE: There were 20 observations read from the data set WORK.FLU_SINGLE2.
> WHERE enroll='Y';
> NOTE: PROCEDURE PRINT used:
> real time 0.01 seconds
> cpu time 0.01 seconds
>
>
> I do not understand why LENGTH function, which I set at the very
beginning, does not work for these fields. Is it because of the macro? Why?
How can I fix it ?
>
> Thank you in advance,
>
> Irin
>
>
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.
>
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small
Business.