Date: Mon, 23 May 2011 08:50:02 -0700
Reply-To: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject: Re: Truncation Warning in V9.2
Content-Type: text/plain; charset=us-ascii
There is a way to suppress this particular message, as Art pointed out, but to me that's not the correct solution.
I think the message itself is addressing a real problem, one that is brought up on SAS-L from time to time: MERGE statements sometimes don't work when input BY variables are of different lengths. There's also the secondary problem that non-BY variables might be accidentally truncated.
It's an all-or-nothing approach. What I would want is the ability to change the length of a single variable (or variables) without getting a warning message, while still allowing SAS to check the length of all the other variables that might be in the data set. There doesn't seem to be a way to do that without jumping through a lot of hoops - not in the data step itself, not by pre-processing the data set in a data step view, and not by pre-processing the data set in an SQL view. The only way that might work, and preserve variable order, would be to use the dictionary tables (or the data set header) to construct an SQL view.
Yeah, yeah, variable order shouldn't order. See about a thousand past questions here about how to preserve it. I still think my proposed VARORDER= data set option would be a good solution.
On May 23, 2011, at 8:10 AM, Warren Schlechte wrote:
> My two cents worth.
> My suggestion is for SAS to give the user the ability to individually
> suppress warnings. So, since Toby feels that this truncation warning is
> unimportant, SAS should allow him (in his code) to suppress this
> specific warning.
> Warren Schlechte
> -----Original Message-----
> From: John Hendrickx [mailto:john2.hendrickx@GMAIL.COM]
> Sent: Saturday, May 21, 2011 3:39 PM
> Subject: Re: Truncation Warning in V9.2
> Probably the same person who thought it would be a good idea to add a
> TOC level to proc report. Check out the ingenious code for suppressing
> John Hendrickx
> 2011/5/21 toby dunn <email@example.com>
>> I honestly have to wonder who the fool was that decided in SAS V9.2 to
>> a warning when you specify a length for a character
>> variable in a length statement that is shorter than the length of the
>> variable in the metadata.
>> Data One ;
>> Length Name $ 7 ;
>> Set SASHELP.Class ;
>> Run ;
>> Produces a warning....
>> Who was the fool that took away the ability to change a variables
>> without cluttering up my log with stupid warnings.
>> Toby Dunn
>> If you get thrown from a horse, you have to get up and get back on,
>> you landed on a cactus; then you have to roll around and scream in
>> "Any idiot can face a crisis-it's day to day living that wears you
>> ~ Anton Chekhov