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

st: how to cut string variables


From   Reka Sundaram-Stukel <[email protected]>
To   [email protected]
Subject   st: how to cut string variables
Date   Thu, 07 Jul 2005 11:58:44 -0400

Dear Statalist,

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
3 D5
4 E10
5 A1
6 B3
...

What I would like to create a variable as follows: dummy=1 if rank contains "b"

How can I do this simply so I don't have to either cut or split the variable (at least I can't figure out how to do this).
Any help would be much appreciated.

Reka

*
* 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