I have a couple hundred thousand income observations within my data. However, when I tried to create buckets, an error message informed me that the variable was a string variable and not numeric (although the variables are numbers). Either way I searched for a work around and -encode- did destring the variables however, it recoded the underlying values to be different numeric values. For example, after using -encode-, although, the value says 40,009 (as average hh income) when you click the value you see that stata actually has coded it 396.
Has any one run into this before? Anyone know of a solution to ensure that 40,009 is the actually value stata reads so that I can make buckets that would be made up of 40000 - 50000, 50000 -60000, etc.
Related Posts with String variable to numeric variable, -encode- command generates new values.
destring before appendHi all, So I am trying to append 3 excel sheets into one Stata file but I would need to destring on…
Calculate average within-unit correlation of variable across timeI have a panel dataset at the firm-year level. I would first like to calculate, within each firm, th…
graph save errorThe following example in Stata 16.1 on a PC and Stata 12.1 on a Mac produces the same error: Code:…
Loop Encode but ignore "."Hello, I have a dataset with ~881k observations and 621 variables that I'm just beginning to clean.…
Storing a command as a macroHello Statalist, I am writing a long .do file that uses the same command at many different points: …
Subscribe to:
Post Comments (Atom)
0 Response to String variable to numeric variable, -encode- command generates new values.
Post a Comment