If Elisabeth really wants to change a prefix on the observations in a
variable (not the variable name itself using -rensfix-), she can use -
subinstr()- or -regexm()- for more complex substitutions, e.g.,
***
clear
input str10 var1
alpha
beta
delta
apple
arch
bean
aaaaaa
end
//change starting "a" only
gen pos = strpos(var1, "a")
replace var1 = subinstr(var1, "a", "1", 1) if pos==1
drop pos
*****
Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
On Nov 2, 2009, at 6:16 AM, E. Paul Wileyto wrote:
Search Stata help:
search rensfix, all
It's a user-written command that is very useful for changing
prefixes and suffixes.
Elisabeth Müller wrote:
Hello,
does anybody know how to change the prefix of an observation (not
variable)? E.g. if I want to change the observation "alpha" into
"1lpha"?
Thanks
--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309
215-746-7147
Fax: 215-746-7140
[email protected]
*
* 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/