DATA Step, Macro, Functions and more

How to use a created Index correctly

Reply
Contributor
Posts: 26

How to use a created Index correctly

Hello,

 

I would like to know why my created index is not matching against entries, and how to do it correctly i guess:

 

example below should match the Match this Value from the MATCH Dataset, but it comes back with a blank value.

 

DATA DAN.test_data1;

input first $char80. second $char80.;

datalines;

MATCH

THIS

NOT

THIS

MATCH

THIS

NOT

THIS

;

run;

DATA match;

input name $char80.;

datalines;

MATCH THIS

;

run;

 

proc datasets library=dan ;

modify test_data1 ;

index create match_name=(first second);

run ;

 

DATA INDEX_MATCH;

SET match;

SET dan.test_data1 KEY=match_name / UNIQUE;

RUN;

 

In the reall world i have 1000 names that i would like to match against a dataset of 1 million rows , creating an index on first and second name - but my results are coming back blank, using effectively the same logic as above.

 

Any help is greatly appreicated

 

Mr E

Frequent Contributor
Posts: 93

Re: How to use a created Index correctly

Were you able to successfully join the datasets without the index?  Is it just that you have been successful at joining the datasets but would like to speed up the process, or that you have not joined them yet and will do so using index?

 

It may be expedient and clearer for you to split the combined first/last name cell in match.name into separate cells. Then, create your index on the first/last name columns.

Ask a Question
Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation