Date: Sun, 29 Jun 2008 11:15:32 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>"
<schreier.junk.mail@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>"
<schreier.junk.mail@GMAIL.COM>
Subject: Re: Summary: Re: Table combining tables? PROC FREQ or maybe
array? or checkall?
On Sun, 29 Jun 2008 09:09:18 -0400, Peter Flom
<peterflomconsulting@MINDSPRING.COM> wrote:
>Problem solved! Thanks all!
>
>Howard wrote
>>
>>>NOTE: Numeric variables in the input data set will be converted to
>>character in the output data
>>> set.
>>
>>**********
>>
>>This is suspicious. Are some of the V3_ variables character rather than
numeric?
>>
>
>Yes, there were some. And when I re-ran it with just the numeric
variables, it worked perfectly.
>
>Thanks again!
>
>Peter
>
>Peter L. Flom, PhD
>Statistical Consultant
>www DOT peterflom DOT com
Now we can fill in the details. Because the variables being transposed were
a mixture of numeric and character, PROC TRANSPOSE converted the numeric
values to character. The characteristics of the resulting transposed
variable depend on the lengths and justifications of the original character
variables. The converted values we know will have 11 leading blanks (from
the BEST12. format used in the conversion). In any case, my WHERE statement
implicitly assumed it would be testing 0/1 numerics. It does not filter out
any of the character values. Hence the incorrect results Peter saw. The code
can be strengthened by changing the WHERE statement to
where left(col1)='1';
Peter said earlier that the data set was provided to him by another party. I
think he was then a bit too eager to get started on the tests and
tabulations he was supposed to do. It's usually a good idea to first inspect
the data to make sure it is what it is supposed to be, and it is what it
appears to be. Next, do whatever conditioning is needed to fix problems and
to make the data more SAS-friendly. Then do the work the client/boss wants.
|