Joseph,
thank you very much for your help and I solved my problem by the method you suggested.
By the way, is it a general way to deal with eliminating double quotes surrounding letters?
Namely, is there a function applied in this situation? I tried -real()- function, however, I got a missing value.
Thank you for any help.
Best regards,
Rose.
----- Original Message -----
From: Joseph Coveney <[email protected]>
To: <[email protected]>
Subject: st: Re: How to eliminate the double quotes surrounding letters?
Date: 2009-8-29 16:41:00
Rose wrote:
I have a localname xy containing some letters among which there is space.
And I want rename a variable the localname xy. Due to the space, I took the
-subinstr- funtion to eliminate the space. However, that treatment produced
double-quotes surrounding the letters. How to deal with it?
To make what I said clear, I take an example below.
local xy "ab cd ef"
rename variable subinstr("`xy'"," ","",.)
Based on the typing above, Stata gives an error message "( not allowed r(101)".
--------------------------------------------------------------------------------
Use `=. . .' to evaluate the function. See example below for details.
Joseph Coveney
. sysuse auto
(1978 Automobile Data)
. keep make
. local xy "ab cd ef"
. rename make `=subinstr("`xy'"," ","",.)'
. describe
Contains data from C:\Program Files\Stata11\ado\base/a/auto.dta
obs: 74 1978 Automobile Data
vars: 1 13 Apr 2009 17:45
size: 1,628 (99.9% of memory free) (_dta has notes)
--------------------------------------------------------------------------------
------------------------
storage display value
variable name type format label variable label
--------------------------------------------------------------------------------
------------------------
abcdef str18 %-18s Make and Model
--------------------------------------------------------------------------------
------------------------
Sorted by:
Note: dataset has changed since last saved
.
*
* 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/