Previous Page | Next Page

The DQMATCH Procedure

Example 4: Creating Match Codes for Parsed Values


The following example creates match codes for parsed character data. The program loads locales, determines a parse definition, creates character elements, creates parsed character values, and creates match codes for the parse character elements.

/* load locales */
%dqload(dqlocale=(enusa), dqsetuploc=('your-dqsetup-file-here')

/* Determine the parse definition associated with your */
/* match definition.                                   */
data _null_;
   parsedefn=dqMatchInfoGet('Name');
   call symput('parsedefn', parsedefn);
   put 'The parse definition for the NAME match definition is: ' parsedefn;
   tokens=dqParseInfoGet(parsedefn);
   put 'The ' parsedefn 'parse definition tokens are:' / @5 tokens;
run;

/* Create variables containing name elements. */
data parsed;
   length first last $ 20;
   first='Scott'; last='James';  output;
   first='James'; last='Scott';  output;
   first='Ernie'; last='Hunt';   output;
   first='Brady'; last='Baker';  output;
   first='Ben';   last='Riedel'; output;
   first='Sara';  last='Fowler'; output;
   first='Homer'; last='Webb';   output;
   first='Poe';   last='Smith';  output;
run;

/* Create parsed character values. */
data parsedview;
   set parsed;
   length delimstr $ 100;

   * Insert one token at a time;
   delimstr=dqParseTokenPut(delimstr, first, 'Given Name',  'Name');
   delimstr=dqParseTokenPut(delimstr, last,  'Family Name', 'Name');
run;

/* Generate match codes using the parsed character values. */
proc dqmatch data=parsedview
             out=mcodes;
   criteria matchdef='Name' delimstr=delimstr sensitivity=85;
run;

/* Print the match codes. */
proc print data=mcodes;
   title 'Look at the match codes from PROC DQMATCH';
run;

Note:   This example is available in the SAS Sample Library under the name DQMCPARS.  [cautionend]

Previous Page | Next Page | Top of Page