'Remove symbol from string variable
I would like to remove the $ symbol from the observations of a Stata string variable (GDP per capita), in order to turn the variable from string to numerical. All the rows of the variable need the $ symbol to be removed.
Solution 1:[1]
clear
input str6 problem
"$123"
"$3456"
"$67890"
end
destring problem, ignore($) replace
list
+---------+
| problem |
|---------|
1. | 123 |
2. | 3456 |
3. | 67890 |
+---------+
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nick Cox |
