You could try
g byte dummy=(index(lower(rank),"b")>0)
-----Original Message-----
From: Reka Sundaram-Stukel [mailto:[email protected]]
Subject: st: how to cut string variables
I am trying to cut a variable so that I just keep the string portion
of it. I have search the help for various options but it seems if you
don't have a uniform stub you can't cut.
For example: my variable is:
Id Rank
1 A2
2 B3
What I would like to create a variable as follows: dummy=1 if rank
contains "b"
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/