Hi,
I have values in my variable (tax_threshold) with many "0" values. I want to replace all the "0" with missingvalue1, missingvalue2, missingvalue3...etc. How can I do it? I have tried many commands but I either get a "type mismatch" error, or other errors.
My main goal is to convert my data set from long to wide but STATA does not let me do it and gives error if there are missing values or many values which are same. The "missingvalue"s you see under rate, I created them in excel but it takes a long time.
My data set looks something like this:
Country ID rate tax_threshold
Albania 1 0 30000
Albania 2 .13 150000
Albania 3 .23 0
Albania 4 missingvalue1 0
Albania 5 missingvalue2 0
Albania 6 missingvalue3 0
Albania 7 missingvalue4 0
Albania 8 missingvalue5 0
Albania 9 missingvalue6 0
Albania 10 missingvalue7 0
Albania 11 missingvalue8 0
Albania 12 missingvalue9 0
Albania 13 missingvalue10 0
Albania 14 missingvalue11 0
Albania 15 missingvalue12 0
Albania 16 missingvalue13 0
Albania 17 missingvalue14 0
Albania 18 missingvalue15 0
Algeria 1 missingvalue16 10000
Algeria 2 missingvalue17 30000
Algeria 3 missingvalue18 120000
Algeria 4 missingvalue19 0
Algeria 5 missingvalue20 0
Algeria 6 missingvalue21 0
Algeria 7 missingvalue22 0
Algeria 8 missingvalue23 0
Algeria 9 missingvalue24 0
I want the data set to look like this:
Country Rate1 Tax_threshold1 Rate2 Tax_threshold2
Albania
Algeria
I will really appreciate if someone can help me. Thank you.
Related Posts with Query in STATA
asdoc: version update - New features of font, table header formatting, etc. Export results to Word from StataVersion 2.3.3.2, dated Feb 23, 2019, is finally here, thanks for Kit Baum for updating it on SSC. Th…
Predicted probabilities with mimrgns after xtgeeHello, This question refers to Daniel Klein's excellent mimrgns program. I am attempting to obtain …
Hep with spmap option polygonHi, Im working in a map of the metro area of Medellín, Colombia. So far good, but when I try to impo…
Analyzing length of stay in clustered data (back transform)Hello, I'm a relatively new Stata user and am working on a project. I'm looking at length of stay (…
Help with scheme entries affecting rarea plots using marginsplotI am trying to create a scheme that changes the intensity, opacity, or color of a marginsplot when t…
Subscribe to:
Post Comments (Atom)
0 Response to Query in STATA
Post a Comment