| Date: | Fri, 10 Nov 2000 04:04:28 GMT |
| Reply-To: | Pete Lund <pete.lund@HOME.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Pete Lund <pete.lund@HOME.COM> |
| Organization: | @Home Network |
| Subject: | Re: SAS Language |
| Content-Type: | text/plain; charset=us-ascii |
Michelle-
One simple way is to read the variable in as a character string and
look for the minus sign. If it's there, strip it off and multiply the
remaining number by -1. If not, simply convert the string to a
number.
For example, if the flat file contained only the number in question:
data <------>;
infile <-------->;
input CharNmbr $10.;
if substr(CharNmbr,length(CharNmbr),1) eq '-' then
TheNmbr = input(substr(CharNmbr,1,length(CharNmbr)-1),10.) * -1;
else TheNmbr = input(CharNmbr,10.);
run;
Hope this helps-
Pete
(I don't have SAS on this machine, but this should work.)
On Fri, 10 Nov 2000 03:10:08 GMT, michelle_kay@my-deja.com wrote:
>Hi everyone,
>
>I need to import a numeric field into SAS from a flat file that I
>downloaded from mainframe system. All negative numbers have the minus
>signs in the back of the number instead of in front of the number. How
>do I read this and convert it into a correct format?
>
>original Desired
>70248- -70248
>45478 45478
>21838- -21838
>45780- -45780
>55454 55454
>45015 45015
>
>Thank you for your help.
>
>Michelle Kay
>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
|