Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need basic solution to a SAS problem on the mainframe

Status
Not open for further replies.

mhw

MIS
Jul 2, 2001
13
US
I'm working with SAS version 8.2 on the mainframe and I'm trying to do a very simple extract of a subset of a data file. The input file is variable blocked, VB and so is the output file. I can't seem to get any output. The messages in the SASLOG say that all the records were read but no output comes out. Since I'm not familiar with SAS at all and am just learning it, I'm not sure if I've coded the proper output functions. Can someone review my code and suggest some improvements?
Thanks,
MHW

OPTIONS PAGESIZE=60;
DATA MASTER;
INFILE DATAIN RECFM=VB LRECL=354 END=EOF;
INPUT
@9 RPT 2;
IF RPT = 10
THEN INPUT
@5 STUFB4 6.
@11 OFFICE 3.
@14 STUFAFTR $CHAR341.
;
DATA MASTER2;
FILE DATAOUT RECFM=VB LRECL=354;
IF OFFICE IN (131 140)
SET MASTER2;
PUT @5 STUFB4 6.
@11 OFFICE 3.
@14 STUFAFTR $CHAR341;
;
 
Hi!

Try this change:

DATA MASTER2;
SET MASTER;
IF OFFICE IN (131 140) Then Do;
FILE DATAOUT RECFM=VB LRECL=354;
PUT @5 STUFB4 6.
@11 OFFICE 3.
@14 STUFAFTR $CHAR341;
End;
;

Not knowing exactly what you are trying to do makes it difficult to help. Let me know how this did.

hth
Jeff Bridgham
bridgham@purdue.edu
 
I'm not sure if this is correct, but don't you need to add a trailing @ before the semicolon on your first INPUT statement (to hold the current observation)? For example:

INPUT @9 RPT 2. @;

Hope this helps. I've always worked with fixed records on the mainframe, so I'm not very familiar with variable blocked.

 
If you're still wondering --- try this on a "vector switch" and save yourself some cpu time of reading the file twice.
And yes --- you need that "@;" as a place holder.

OPTIONS PAGESIZE=60;
DATA MASTER;
INFILE DATAIN RECFM=VB LRECL=354 END=EOF;
INPUT @9 RPT 2
@;
IF RPT = 10 THEN
INPUT @5 STUFB4 6.
@11 OFFICE 3.
@14 STUFAFTR $CHAR341.
;
IF OFFICE IN (131,140)
THEN DO;
FILE DATAOUT RECFM=VB LRECL=354;
PUT @5 STUFB4 6.
@11 OFFICE 3.
@14 STUFAFTR $CHAR341;
END;
RUN;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top