| Date: | Thu, 4 Nov 2010 08:44:32 -0400 |
| Reply-To: | Nat Wooding <nathani@VERIZON.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Nat Wooding <nathani@VERIZON.NET> |
| Subject: | Re: SAS on mainframe |
| In-Reply-To: | <201011040044.oA3LXseG006441@willow.cc.uga.edu> |
| Content-Type: | text/plain; charset="US-ASCII" |
Vivian
I have not had to read packed data in quite a while but since I have not
seen any replies to your question, I will say a little.
First, are you trying to read a field with only numbers in it? If so, I
would try to read it as a number with formats such as PD2. or PK2. There
is a section in the base sas dictionary of language elements on working with
such data.
Next, based on what I see of your code, there is no reason to write
IF LAYOUT='05' THEN LINK SF05;
SF05:
The line If Layout = '05' then do is sufficient. Links are seldom used
these days and I see no need for one here.
If you are reading numeric values only, I would use a numeric format and
change the statement to
If layout = 5 then input...
Also, the line
IF VAR NE 'ABC' THEN OUTPUT SF05;
Will never create output since you are not reading a variable called "VAR".
Nat Wooding
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of V V B
Sent: Wednesday, November 03, 2010 8:45 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: SAS on mainframe
Hi,
I need help reading the following field. I'm using mainframe SAS 8.2.
I've tried pd2. pk2. 2. $2. and many other various informats without
success. The pk2. with display single digits, however, the value in the
field can be 1 to 99.
Your help most appreciated!
Vivian
-- FIELD LEVEL/NAME ----- --- --PICTURE-- FLD START END LENGTH
15 FM1E1-SEQ-NUM 99 15 24 25 2
DATA
SF05(KEEP=VAR1 VAR2 VAR3 VAR4);
INPUT
@022 LAYOUT $2.
@;
IF LAYOUT='05' THEN LINK SF05;
SF05:
IF LAYOUT='05' THEN DO;
INPUT
@001 VAR1 $CHAR17.
@001 VAR2 $CHAR03.
@024 VAR3 ?
@026 VAR4 $CHAR02.
@;
IF VAR NE 'ABC' THEN OUTPUT SF05;
End;
Run;
|