BookmarkSubscribeRSS Feed
MR_E
Obsidian | Level 7

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

1 REPLY 1
thomp7050
Pyrite | Level 9

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 615 views
  • 0 likes
  • 2 in conversation