Good morning,
I have a string variable (name : massenumsq1_sq1) which represents amounts in euros, imported from a .csv file. The kind of data in the cells are: 1045 or 29 568,43 or 32678 € for instance. There are also blank cells. I want to turn it into a numeric variable but there are non-numeric characters that I don't see. So to find them, I ran:
I need to remove the last 5 characters. How can I specify a list of characters into the ignore() option, only using their ascii code? (It is the only think I know about them).
I tried with:
But any of these attempts is working...
Also I use Stata 17.
Thanks in advance for any help!
I have a string variable (name : massenumsq1_sq1) which represents amounts in euros, imported from a .csv file. The kind of data in the cells are: 1045 or 29 568,43 or 32678 € for instance. There are also blank cells. I want to turn it into a numeric variable but there are non-numeric characters that I don't see. So to find them, I ran:
Code:
charlist massenumsq1_sq1 if missing(real(massenumsq1_sq1)) ,01234579����� . return list macros: r(chars) : ",01234579�����" r(sepchars) : ", 0 1 2 3 4 5 7 9 � � � � � " r(ascii) : "32 44 48 49 50 51 52 53 55 57 128 130 172 175 226 "
I tried with:
Code:
* without quotation marks destring massenumsq1_sq1, dpcomma ignore(`char(128)'`=char(130)'`=char(172)'`=char(175)'`=char(226)') replace invalid Unicode characters may not be ignored when removing aschars r(198); * one couple of quotation marks destring massenumsq1_sq1, dpcomma ignore("`char(128)'`=char(130)'`=char(172)'`=char(175)'`=char(226)'") replace invalid Unicode characters may not be ignored when removing aschars r(198); * quotation marks for each character destring massenumsq1_sq1, dpcomma ignore("`=char(128)'","`=char(130)'","`=char(172)'","`=char(175)'","`=char(226)'") replace invalid '"�' r(198);
Also I use Stata 17.
Thanks in advance for any help!
Comment