DATA Step, Macro, Functions and more

Filtering in a PROC IMPORT

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Filtering in a PROC IMPORT

When doing a PROC IMPORT, can I add a filter here?  If so, where?  I am a basic SAS user so any help would be appreciated.

 

 

PROC IMPORT TABLE="Sales" OUT=Sales

DBMS=access

REPLACE;

DATABASE="\\americredit.com\db_files\AOC\SA\AR\Analytics\RDW.accdb";


Accepted Solutions
Solution
‎11-22-2016 02:02 PM
Trusted Advisor
Posts: 1,022

Re: Filtering in a PROC IMPORT

Posted in reply to TMiller16

You  can use what are called "data set name parameters", and a "where" expression can be one of those paramenters.

 

PROC IMPORT TABLE="Sales" OUT=Sales  (where=(logical expression here));

DBMS=access

REPLACE;

DATABASE="\\americredit.com\db_files\AOC\SA\AR\Analytics\RDW.accdb";

 

Unfortunately the filter is applied when writing the output, not on reading the input.

 

 

View solution in original post


All Replies
Super User
Posts: 7,866

Re: Filtering in a PROC IMPORT

Posted in reply to TMiller16

Try to add a where= dataset option to your output dataset Sales.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎11-22-2016 02:02 PM
Trusted Advisor
Posts: 1,022

Re: Filtering in a PROC IMPORT

Posted in reply to TMiller16

You  can use what are called "data set name parameters", and a "where" expression can be one of those paramenters.

 

PROC IMPORT TABLE="Sales" OUT=Sales  (where=(logical expression here));

DBMS=access

REPLACE;

DATABASE="\\americredit.com\db_files\AOC\SA\AR\Analytics\RDW.accdb";

 

Unfortunately the filter is applied when writing the output, not on reading the input.

 

 

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 423 views
  • 0 likes
  • 3 in conversation