Date: Tue, 23 Nov 2004 16:43:22 -0500
Reply-To: James Blaha <jblaha@PACE.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: James Blaha <jblaha@PACE.EDU>
Subject: Re: SAS sample code needed
In-Reply-To: <AD11F90BB3FCF84C965D8F3E3BC66230268F79@XCH-NW-26.nw.nos.boeing.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Barry, Stéphane, Jack, Toby, All..
Thank you all so much for your time and effort. I’ll try these
recommendations out first thing tomorrow morning.
Regards,
-JB
Schwarz, Barry A wrote:
>Try something like
>
> LENGTH output $10;
> output = COMPRESS(PUT(field,Z11.2),'.');
> SUBSTR(output,10,1) = TRANSLATE(SUBSTR(output,10,1),
> '{ABCDEFGHI',
> '0123456789');
>
>Barry Schwarz
>OS/390 System Programmer
>M/S 80-JE
>Phone: 253-773-4221
>Fax: 253-773-1257
>
>
>-----Original Message-----
>From: James Blaha [mailto:jblaha@PACE.EDU]
>Sent: Tuesday, November 23, 2004 11:55 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: SAS sample code needed
>
>
>SASlers,
>
>I was wondering if someone could please help me out with some sample
>code.
>
>Let say I have a numeric field in a database that's a maximum of 10
>digits long
>
>Value in field row 1= 100.25
>Value in field row 2= 2223.99
>
>I need to output this field to take up 10 character spaces in a flat
>file in the following format:
>
>1. Right justified
>2. Leading zeros filled in
>2. Assumed decimal
>
>The data would look just like this:
>
>100.25 would become 0000010025
>2223.99 would become 0000222399
>
>Then I need to go one step further and pick off the last digit on the
>right and replace it with one of these codes.
>
>Here is the translation needed for the last digit in the field.
>
>{ = 0
>A = 1
>B = 2
>C = 3
>D = 4
>E = 5
>F = 6
>G = 7
>H = 8
>I = 9
>
>Final Desired Outcome:
>0000010025 is equal to 000001002E
>0000222399 is equal to 000022239I
>
>I hope this makes sense.
>
>Regards,
>James Blaha
>
>
>
>
|