Monday, March 22, 2010

SAS search macro

I have written a search macro in SAS which performs text search on various variables. It allows for and/or logic although only one at a time. Let me know what you think. Can be downloaded form Google Docs.

%search(dset, search data set
    str, characters to search for
    vars, variables to search in
    or=N,    N=and Y=or
    case=N, Y=case sensitive
    word=Y, Y=look for word N=look for words containing
    print=Y Y=prints
    out=search output data set

%search(one,dirk nachbar,firstname lastname) searches for dirk AND nachbar (not case sensitive) in variables firstname
 and lastname in table one

No comments: