| Date: | Fri, 10 Nov 2000 10:57:16 -0500 |
| Reply-To: | Richard.Graham@INTELLICISIONS.COM |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Richard W. Graham" <Richard.Graham@INTELLICISIONS.COM> |
| Subject: | Re: SAS Language |
|
| Content-type: | multipart/mixed;
Boundary="0__=SEXR2pinO51IcGpNg3VwBi0g2vgnqhqUm4NmhH4ECLqdaZXKh3bgsg8I" |
|---|
For those of us who are anal about getting pesky notes indicating
character values have been converted to numeric values you may want to
include the input functions on the numval statement
numval=input(scan(charval,1),8.)*input(scan(charval,2,'*'),8.);
Richard W. Graham
Senior Consultant, Technology Delivery
Intellicisions Data Inc.
2000 Regency Parkway, Suite 355
Cary, NC 27511
www.intellicisions.com
(919) 467-0505
(Embedded image moved to file: pic09607.gif)
David Ward
<dward@SASHELP To: SAS-L@LISTSERV.UGA.EDU
.COM> cc: (bcc: Richard Graham/Tech/Intellicisions)
Sent by: Subject: Re: SAS Language
"SAS(r)
Discussion"
<SAS-L@LISTSER
V.UGA.EDU>
11/10/00 10:31
AM
Please respond
to David Ward
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
pic09607.gif [image/gif]
|