Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: how to cut string variables


From   austin nichols <[email protected]>
To   [email protected]
Subject   st: RE: how to cut string variables
Date   Thu, 7 Jul 2005 12:03:59 -0400

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index