Link to home
Start Free TrialLog in
Avatar of morinia
moriniaFlag for United States of America

asked on

Wildcard "if" statement in SAS

How do I check a field in SAS equal to anything with the word "Parent" or "p_"  in the field?
Avatar of giltjr
giltjr
Flag of United States of America image

Not sure about anywhere, but

IF (NAME = :"STR" )

Will match if the field name starts with STR.  I'm not sure you can do something like:

IF (NAME = :"STR":) if it would match if the field name contains "STR" anyplace.
Avatar of morinia

ASKER

The above solution did not work.
Avatar of morinia

ASKER

I was able to use substring to check for the first csix characters.  I can;t figure out how to check if unknown as to where in the string a particualr subset is.
ASKER CERTIFIED SOLUTION
Avatar of bradanelson
bradanelson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of morinia

ASKER

Bradanelson,

Is index being set in a loop?
I don't understand your last question.  The IF statement I gave will be true if Parent or p_ is anywhere in the value of fieldname.  Replace fieldname with your field and add the statement or statements after the THEN in your code.
Avatar of morinia

ASKER

It worked fine!!