LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 28 Apr 2000 11:14:25 -0700
Reply-To:     Puddin' Man <pudding_man@ALTAVISTA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Puddin' Man <pudding_man@ALTAVISTA.COM>
Subject:      Re: Finding a string in a variable
Content-Type: text/plain

Is it possible that Foster needed to search all character vars?

Following tested code illustrates approach to selecting only obs with an unspecified char var that contains both "Minnesota" and "brown":

data a; input (c1 c2) (&$char36.); put _all_; array char _character_; flg=0; drop flg; do over char; if index(char,'Minnesota') and index(char,'brown') then do; flg=1; leave; end; end; if flg then output; cards; brown cow in Minnesota violet aardvard in Hoboken cyan dodo in Oshkosh chartreuse orangutan in Poughkeepsie ; proc print; run;

All warnings re UPCASE/LOWCASE apply ...

Cheers, Puddin'

>>> "Foster Kerrison" <foster@CYBERPORTAL.NET> 04/28/2000 9:02 am >>> Is there a way to "select" a string in a variable in order to select that observation?

For example lets say that the variable content is:

'The brown cow is from Minnesota'.

Can I look for Minnesota in this string, and select this observation as distinct from a cow from Wyoming, or even a black cow? The string (Minnesota/Wyoming/Black cow) could appear anywhere in the variable content?

Foster Kerrison.

***************************************************** *** Puddin' Man *** pudding_man@altavista.com *** *****************************************************;

_______________________________________________________________________

Why pay when you don't have to? Get AltaVista Free Internet Access now! http://jump.altavista.com/freeaccess4.go

_______________________________________________________________________


Back to: Top of message | Previous page | Main SAS-L page