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 (September 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 21 Sep 1999 09:08:07 -0400
Reply-To:     Jack Shoemaker <JShoemaker@ACCORDANT.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Shoemaker <JShoemaker@ACCORDANT.NET>
Subject:      Reading semi-packed ASCII data
Content-Type: text/plain; charset="iso-8859-1"

Dear SAS-L,

I have data from an external source with a COBOL-ish picture description of S9(09)V99. It has been converted to ASCII in such a way that the sign and low-order information is rendered in a single character. For example, a 'B' indicates that the sign is positive and that the low-order value is 2. In other words,

4121139739B

Corresponds to 412,113,973.92.

There are twenty possible values for this trailing character - 10 for positive values and 10 for negative values. I know what they all are and have loaded them into two formats called $sign and $value. Now I have this piece of code:

input @1 _T 10.1 @11 _Nibble $1.; T = ( _T + ( put( _Nibble, $value. ) / 100 ) ) * put( _Nibble, $sign. );

to read the contents of the field into a numeric variable called T. Seems pretty ugly to me. Is there a better way to skin this cat? I am running SAS V7(P1) on WNT.

TIA - Jack

-- Jack N Shoemaker / JShoemaker@Accordant.net


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