Statalist The Stata Listserver


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

Re: st: HELP! recoding string or long variable into some "text" format


From   Philipp Rehm <[email protected]>
To   [email protected]
Subject   Re: st: HELP! recoding string or long variable into some "text" format
Date   Mon, 14 May 2007 23:16:19 +0200

Try -replace- instead of -recode-.
Example:
clear
set obs 1
gen str test="foo"
replace test="bar" if test=="foo"

HTH,
Philipp



Marcos Feldman wrote:
Dear stata users,

can anyone help me figure this out? i am
trying to create a new variable based on an existing variable
containing zoning codes. i actually have two variables with the zoning
codes, one is string format another is long format. the codes (values)
in both look like this: 0001, 0004, 0072, 9001, etc. I want to replace
these codes with their descriptors, e.g., convert 0001 to
"single-family residential," and so on.

thus far stata has not allowed me to recode either string or long variables into "text".

for example, for the long variable "PRI_ZONE" i used the command,
     recode test ("0002"="MULTIFAMILY DUPLEX") ("0100"="SINGLE FAMILY RESIDENCE").... [many more such commands...]
but the response was "unknown el MULTIFAMILY DUPLEX in rule"
is
recoding into text not allowed? have i just written the rules
incorrectly? is there some other way to accomplish this transformation?

thanks!

Marcos Feldman
Research Institute on Social and Economic Policy
Florida International University
University Park LC 308
Miami, FL 33199
305-348-2513
305-348-2241(fax)
[email protected]




____________________________________________________________________________________You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html
*
*   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/

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