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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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