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
Reshaping wide error values of variable date not unique within idHi, I`m fairly new to Stata and I know this question is previously answered however I could not make…
Reshaping data with three dimensionsHello, I am having trouble reshaping my data as it will require something beyond the usual long to w…
Identifying observations of var1 that have different values for var2I have a dataset in which the data are identified by state, county, and ZIP code - each of these is …
Creating a matrix with Euclidean distances between variables.Hello everybody, I use Stata 13.1 and I am working with a dataset that contains 25 numerical variab…
Developing person weights from other variablesI have to "develop person weights from the age and sex variables using an iterative proportional fit…
Subscribe to:
Post Comments (Atom)
0 Response to Query in STATA
Post a Comment