BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lmtamina
Obsidian | Level 7

Good Morning,

 

What is more efficient and faster , attaching my WHERE clause to the SET statement or within the DATA step, which is what I am currently using ? I reading from a dataset using a hash table . Appreciate any advice. Thanks

 

 

data USI_CLAIMS_DATA;

 

length CPT_CODE $5.;

if _N_ =1 then do;

DECLARE HASH H(dataset:'USI_CPTCODES');

H.DEFINEKEY ('CPT_CODE');

H.DEFINEDONE();

end;

 

SET CLAIMS_MASTER(keep=&claims_header);

where serv_from_date ge '1Jan2014'd;

 

if H.find(key:hcpcs_cpt4_base_cd1) = 0 then output;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

It is more efficient to place it in the SET statement because then the data is filtered before you start processing it. This can be noted as using a DATA SET OPTION vs a WHERE statement.

View solution in original post

1 REPLY 1
Reeza
Super User

It is more efficient to place it in the SET statement because then the data is filtered before you start processing it. This can be noted as using a DATA SET OPTION vs a WHERE statement.

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
  • 1 reply
  • 338 views
  • 1 like
  • 2 in conversation