LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1997, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 Dec 1997 19:48:21 GMT
Reply-To:     Melvin Klassen <Klassen@UVIC.CA>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Melvin Klassen <Klassen@UVIC.CA>
Organization: University of Victoria
Subject:      Re: Negative Numbers in ASCII
Content-Type: text/plain; charset="us-ascii"

On Mon, 22 Dec 1997 00:41:24, rrucker808@aol.com (RRucker808) wrote:

> I have an ASCII flat file of raw data on a Unix server. The source for this flat file > is an IBM mainframe file containing packed data, some of which are negative values. > My question is, is there a way I can deal with these negative values > when reading in the ASCII file with SAS?

SAS has been designed to handle this situation. (Would you buy a package which couldn't handle both "credits" and "debits" ? Would you author such a package??)

> Right now, these values just looked like character strings > (example, a negative 160 in the source file appears as a "160p" string).

Your data-value is "negative-1607", not "negative-160". The '7' and the 'negative' have been combined into the 'P'.

Use: { --> +0, A --> +1, B --> +2, ..., I --> +9, and } --> -0, J --> -1, K --> -2, ..., R --> -9 as your "key" to deciphering this data-format, e.g., '2{' --> -20.

> Is there a SAS function or some SAS capability to deal with negative values in ASCII? > In the source file on the mainframe, SAS is able to determine the sign > of a value based on a character flag (either C or D).

The mainframe uses the same "combining" method, rather than a "flag".

> I'm wondering if there's some way to do this with an ASCII file.

Just use the 'PDnn.' informat, and you'll get a "negative-1607" value.


Back to: Top of message | Previous page | Main SAS-L page