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

st: RE: how to cut string variables

From   "Jose Valderrama" <[email protected]>
To   <[email protected]>
Subject   st: RE: how to cut string variables
Date   Thu, 7 Jul 2005 10:59:41 -0500

g d=substr(Rank,1,1)=="A"

-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Reka
Enviado el: Jueves, 07 de Julio de 2005 10:59 a.m.
Para: [email protected]
Asunto: st: how to cut string variables

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.


*   For searches and help try:

*   For searches and help try:

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