Hello,
I am cleaning a large dataset and for most of my variables, I have successfully transformed string to numeric, replacing non-numeric characters. However, for a handful of variables, the non-numeric 'ignore' command ends up dropping the non-numeric categorized data. So for example, my string variable ER_visits has labels 0, 1, 2, and UK. And I wish to destring and ignore 'UK', replacing it with a numeric '3'.
the code I am using is
destring ER_visits, generate(ER_use) ignore(' "UK" ')
when I tabulate the new variable I only see values for 0, 1, 2. All of the values for 'UK' appear to have been dropped.
Any idea why this might be? Many thanks in advance!
I am cleaning a large dataset and for most of my variables, I have successfully transformed string to numeric, replacing non-numeric characters. However, for a handful of variables, the non-numeric 'ignore' command ends up dropping the non-numeric categorized data. So for example, my string variable ER_visits has labels 0, 1, 2, and UK. And I wish to destring and ignore 'UK', replacing it with a numeric '3'.
the code I am using is
destring ER_visits, generate(ER_use) ignore(' "UK" ')
when I tabulate the new variable I only see values for 0, 1, 2. All of the values for 'UK' appear to have been dropped.
Any idea why this might be? Many thanks in advance!
Comment