accessing tab separated file in network folder with filter

Accepted Solution Solved
Reply
Regular Contributor
Posts: 204
Accepted Solution

accessing tab separated file in network folder with filter

Let us say I have a massive tab separated file stored in a network drive visible to SAS. The file contains these columns:

 

 

 

Can I access this file via, for axample PROC SQL, to only populate a SAS dataset based on a subset of this data (e.g. where Id = 1234)?


Accepted Solutions
Solution
‎01-18-2017 06:38 AM
Trusted Advisor
Posts: 1,837

Re: accessing tab separated file in network folder with filter

Posted in reply to csetzkorn

If you use a datastep you can filter data while reading the external file, but if possible

better read the whole file then filter as need using sas tools.

View solution in original post


All Replies
Trusted Advisor
Posts: 1,837

Re: accessing tab separated file in network folder with filter

Posted in reply to csetzkorn

SAS sql will handle SAS dataset, not a TAB separated file.

You need first to import it into sas  using FILENAME ... DLM='09'x;

Use either proc import or a datastep to read the file;

Regular Contributor
Posts: 204

Re: accessing tab separated file in network folder with filter

Posted in reply to csetzkorn
OK thanks. Can I apply filter here?
Super User
Posts: 13,563

Re: accessing tab separated file in network folder with filter

Posted in reply to csetzkorn

I would suggest reading the entire set into SAS. Then you can subset with a WHERE clause in Proc SQL to your hearts content.

 

I do not know the number of times I have had someone tell me we need the "XYZ" values only. And then finish the project and get told "need ABC and XYZ_2" also. If you subset the data too early then you may be rereading the data from scratch many times.

Solution
‎01-18-2017 06:38 AM
Trusted Advisor
Posts: 1,837

Re: accessing tab separated file in network folder with filter

Posted in reply to csetzkorn

If you use a datastep you can filter data while reading the external file, but if possible

better read the whole file then filter as need using sas tools.

Super User
Posts: 10,263

Re: accessing tab separated file in network folder with filter

Posted in reply to csetzkorn

A subsetting if can be used in a data step that reads from a flat file. But I would only contemplate this if the dataset grows to considerable size. Otherwise you're better off by subsetting later.

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 147 views
  • 0 likes
  • 4 in conversation