BookmarkSubscribeRSS Feed
NR13
Fluorite | Level 6

Hi,

 

I'm looking for a way to filter a large dataset that is being read in, using proc sql. I'd ideally like to only read in appointment numbers that match appointment numbers in another dataset. As it stands now, the dataset takes over an hour to read in, so I'm trying to speed it up. In the past I've used something like this:

 

Proc SQL;
    Create Table New as
          Select *
          From All_Scores as A
             ,DI_SCR (where=(DI=&DIid.)) as B
             ,OrgCodes as C
          Where A.APPT_ID=B.APPT_ID
              AND B.DI_ORG_ID=C.ORG_ID;

Quit;

 

The "where=" in the from statement significantly cut down the processing time. Is there a way to do something similar, that only reads in the APPT_IDs from B, if the APPT_ID is also in A? 

 

Thanks in advance!

 

 

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Are these SAS data sets?

Are the tables sorted? Or indexed? Can they easily be kept sorted and/or indexed, or are they refreshed too often?

How many records in each?

You use select *. Do you actually need all columns from all tables?

Please add the _method option after proc sql so we can see how SAS executes the joins.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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