Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: Re: st: Changing specific letter in observations from string variable


From   "Kieran McCaul" <kamccaul@meddent.uwa.edu.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: Re: st: Changing specific letter in observations from string variable
Date   Mon, 4 Aug 2008 17:19:38 +0800

You'll need the ASCII code for ¥ (165 I think) and the ASCII code for Ñ (209, I think).

Then use the string function, regexr.

I think the following should work, 

local old = char(165)
local new = char(209)
gen newvar = regexr(oldvar,"`old'","`new'")



______________________________________________
Kieran McCaul MPH PhD
WA Centre for Health & Ageing (M573)
University of Western Australia
Level 6, Ainslie House
48 Murray St
Perth 6000
Phone: (08) 9224-2140
Phone: -61-8-9224-2140
email: kamccaul@meddent.uwa.edu.au
http://myprofile.cos.com/mccaul 
_______________________________________________

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Max Perez Leon
Sent: Monday, 4 August 2008 5:02 PM
To: statalist@hsphsun2.harvard.edu
Cc: apitaduque@gmail.com
Subject: st: Re: st: Changing specific letter in observations from string variable


Hi,
Recode is used for numerical values only and i don\'t know which observation 
have the error (My dataset has 1800 obs, i cannot check them all).
Saludos,
Max




------ Mensaje original -------
De : apitaduque@gmail.com
Para : statalist@hsphsun2.harvard.edu
Fecha : Mon, 04 Aug 2008 01:42:25 -0700
Asunto : Re: st: Changing specific letter in observations from string variable
>Hola,
>
>Para resolverlo puedes usar el comando \"recode\". Los detalles los puedes 
>ver en la ayuda.
>Saludos.
>
>Angel Pita-Duque
>PhD Candidate
>Geography Graduate Group
>University of California Davis
>One Shields Av.
>2425 Hart Hall
>Davis, CA. 95616
>Phone: +530-754 9576
>
>
>
>Max Perez Leon wrote:
>>
>> Hello,
>> I have a dataset that has the following problem:
>>
>> I suppose my dataset had some problem in a conversion from dbf to dat 
>> and now, some observations in one of my string variable have the next 
>> form:
>> ...
>> BA¥OS
>> SA¥O
>> CA¥ARIS
>> HUA¥EC
>> ...
>>
>> but they should be:
>>
>> ...
>> BAÑOS
>> SAÑO
>> CAÑARIS
>> HUAÑEC
>> ...
>>
>> How could I change that single letter?
>> Thanks,
>> Max PUCP-IEP
>>
>>
>>
>>
>>
>>
>>
>>        
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>*
>*   For searches and help try:
>*   http://www.stata.com/help.cgi?search
>*   http://www.stata.com/support/statalist/faq
>*   http://www.ats.ucla.edu/stat/stata/
>         

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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