Date: Fri, 10 Nov 2000 10:31:24 -0500
Reply-To: David Ward <dward@SASHELP.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Ward <dward@SASHELP.COM>
Subject: Re: SAS Language
Content-Type: text/plain; charset="us-ascii"
Another solution to add into the mix. Add '*1' to the end of the character value, then convert '-*' into '*-' so that you have, in effect, a product in your charcter value:
213423*-1
235255*1
Then just multiple the left side of the '*' and the right side.
data _null_;
length numval 8 charval $8;
infile cards;
input charval $8.;
charval=tranwrd(trim(charval)||'*1','-*','*-');
numval=scan(charval,1)*scan(charval,2,'*');
put numval=;
cards;
70248-
45478
21838-
45780-
55454
45015
;
run;
David Ward
>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
|