home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!gatech!paladin.american.edu!auvm!UMSLVMA.BITNET!NASSER
- Message-ID: <SAS-L%92090815373171@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 3 Sep 1992 22:40:25 CDT
- Reply-To: David Nasser <NASSER@UMSLVMA.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: David Nasser <NASSER@UMSLVMA.BITNET>
- Subject: *Complex* Char Comparisons
- Lines: 62
-
- Content : Question
- Summary : Re: new character manipulation tricks in SAS 6.07?
- System(s) : MVS/ESA/SAS 6.07 et. al.
- Name : David Nasser
-
- Do we have some new 6.07 goodies that enable us to better handle
- *complex* character comparisons?
-
- Specifically, if 2 poor unknown souls independently keyed in char.
- fields of (say) length >=40, and we need to merge and compare for
- _major_ differences, do we have new means of doing so?
-
- Example of _major_ diff.:
- VAR1='The rain in Spain falls mainly on the plain';
- VAR2='THE PRECIPITATION IN ALBEQUERQUE IS TRIVIAL';
-
- Example of _minor_ diff.:
- VAR1='The rain in Spain falls mainly on the plain';
- VAR2='THE RAEN IN SPAIN FALLS MAINLEE ON THE PLAIN';
-
- Things to flag in the comparison:
- Differing number of "words" (as returned by SCAN(VAR,I,' '), I=1,N).
- Two or more chars that differ in any given pair of "words".
-
- Things to ignore in the comparison:
- Case.
- Blanks, any number, in any position.
- Single char typos (one per "word").
-
- This sort of thing has been discussed on SAS-L before. I checked the
- SQL manual for "the LIKE condition": no apparent help. Seems that
- someone mentioned a new data step comparison operator (or was it a
- function??) in 6.07, but I couldn't find anything running MVS/TSO
- 6.07 on-line help. Ran DATABASE SEARCH on subject SOUNDEX, have yet
- to receive info from UGA, MARIST, or OHSTVMA.
-
- Yes, I could code a macro to do this. Its invocation might look like:
-
- MERGE THISUN THATUN;
- BY ID;
- RC=0;
- ** MACRO CCCOMP SETS RC=1 IIF *MAJOR* DIFFERENCES EXIST **;
- %CCCOMP(_VAR1=VAR1,_VAR2=VAR2,_RC=RC)
- IF RC;
- PROC PRINT;
-
- where the actual macro code (SCAN, SUBSTR, etc.) is doing *unspeakable*
- things with the _hideous and insideous_ parsing, and like dat.
- Noooo-bodeeeee wants to do this (if it can be avoided).
-
- Cigar and a beer for an elegant solution. Many thanks in advance for
- anything thats not truly ugly. Will summarize if interest merits.
-
- Salut,
- David
-
- David Nasser NASSER@UMSLVMA
- St. Louis, Mo NASSER@UMSLVMA.UMSL.EDU
-
- "Gimme back my wig,
- And let your head go bald!!"
- Hound Dog Taylor
-