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!

Import File with 2 conditions

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hello

I have a very large flat file that I am importing some of the data elements into SAS.

I run the first report based on specific institutions and the code looks like this:

data mylib.shelbyHosp;
infile 'c:\My Documents\data.txt' truncover LRECL = 3000;
input @1 Inst $5. @;
if Inst not in ('53987','54108','54197','54241','54249','54258','54320','54413') then delete;
input @6 Fyear $4.
@10 Period 2.
@12 Abstr $7.
@19 Prov $2.
@35 IssProv $2.
@59 Enc $3.
@62 Postal $6.
@68 Rescode $7.
@75 Sex $1.
@85 FP $1.
@89 RFP $2.;
run;

Then I run on specific residence codes but not any that have the institution numbers from the first extraction. This code doesn't work and gives me all cases with the rescode and ignores the institution notes. How can I combine the statements?

data mylib.shelbyHosp;
infile 'c:\My Documents\data.txt' truncover LRECL = 3000;
input @68 Rescode $7.
@1 Inst $5. @;
If Rescode not in ('3301','3302','3305','3306','3307','3317','3329','3331','3334','3337','3338','3341','3344','3345','3346','3347','3348','2001','2002','2003','2004','2005','2006','2007','2008','0731','0739','0832','2721','3319') and Inst in ('53987','54108','54197','54241','54249','54258','54320','54413') then delete;
input @6 Fyear $4.
@10 Period 2.
@12 Abstr $7.
@19 Prov $2.
@35 IssProv $2.
@59 Enc $3.
@62 Postal $6.
@68 Rescode $7.
@75 Sex $1.
@85 FP $1.
@89 RFP $2.;
run;

Is there any way to combine both data sets into one so that I don't have to combine in Access?

Thanks very much.

Shelby

 
This is the same as your other question isn't it?
Why not read everything in in one go. Then use where clauses on your reports to separate out what you need. It'll be alot simpler.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top