Date: Fri, 11 Nov 2005 13:05:37 -0800
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Sort and Append
In-Reply-To: <200511110537.jAB4155g016468@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed
gsingh24@GMAIL.COM wrote to me:
>David,
>
>As you might guess, I posted a sample code on the user-group. The
>actual data set has more variables both character and numeric. The code
>worked but I got missing values for some of the variables. The log
>shows what the character values were converted to numeric. Why were all
>the values converted to numeric? Would the code only process numeric
>variables?
It looks like you've already gotten everything patched up.
But in answer to your question, the problem is simple. A SAS array can hold
numerics. Or it can hold character variables. But not both. So you would
want to define an array of all your numeric variables, and an array of all
your
character variables, and then load the two of them.
Since you are having to shove this stuff into an Excel spreadsheet later,
you
are probably going to want to put a LENGTH or ATTRIB statement at the very
top of the data step, with your variables listed in the order you'll want
them to
have. Otherwise, you'll need to re-order them later. You see, the two
arrays
will mean that you'll get all the numeric variables in a row in the output
data set,
then all the character variables, unless you first tell SAS about the
variables in
a statement like RETAIN, LENGTH, or ATTRIB.
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
|