Subject: | |
From: | |
Reply To: | |
Date: | Tue, 31 Oct 2006 07:47:06 -0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi Barry,
wouldn't substring() do the trick? Something like:
recode a=1 if substring(name,1,4)=="Hoov"
Best,
Indriši
______________________________
Indridi H. Indridason
Associate Professor/Associate Chair
Department of Political Science
Oddi v/Sturlugotu
University of Iceland
101 Reykjavik
Iceland
e-mail: [log in to unmask]
tel: +354 525 5209
homepage: www.hi.is\~ihi
----- Original Message -----
From: "Barry C. Burden" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Monday, October 30, 2006 9:59 PM
Subject: [POLMETH] Stata string wildcards
> I am trying to write some if/then statements in Stata that depend on the
> value of a string variable. The trouble is that variable contains names
> that are not always spelled the same way or written out fully. For
> example, in one observation the name is written as "Hoover, Herbert" but
> in another observation it has been shortened to "Hoover, Herb." To
> capture both of these possibilities I would like to tell Stata to recode
> if y=="Hoov*" or some such thing. Unfortunately, the user guide isn't
> clear about the use of wildcards with string variables and my own
> experiments have failed. Perhaps this is a better question for the
> Stata users list, but I thought another political scientist who has
> worked with strings might be able to come through with a solution.
>
> Barry
>
>
>
> ----------------------------------------
> Barry C. Burden
> University of Wisconsin
> Department of Political Science
> http://mywebspace.wisc.edu/bcburden/web/
>
> **********************************************************
> Political Methodology E-Mail List
> Editor: Karen Long Jusko <[log in to unmask]>
> **********************************************************
> Send messages to [log in to unmask]
> To join the list, cancel your subscription, or modify
> your subscription settings visit:
>
> http://polmeth.wustl.edu/polmeth.php
>
> **********************************************************
>
**********************************************************
Political Methodology E-Mail List
Editor: Karen Long Jusko <[log in to unmask]>
**********************************************************
Send messages to [log in to unmask]
To join the list, cancel your subscription, or modify
your subscription settings visit:
http://polmeth.wustl.edu/polmeth.php
**********************************************************
|
|
|