I am trying to sort income based on marital Status and then generate new adjusted income based on tax brackets. There is one variable "income" and then another variable "married". The income variable just has the total income. The "married" variable has either the value 1 (which corresponds to being married) or 2 (which is a single filer).
How do I generate two new variables based on marital Status? So a married income and a single income?
I have tried using this, but it doesn't work.
gen incsing = income if married = 2
Please help!
Related Posts with Generating new variables using an if function
using foreeach loop for doing repeating worki want to save observations in different files on the basis of values of variable order. i have lots…
confirm numeric format returns error code 111I'm wanting to use confirm numeric format to check that a user-entered format is valid, but when the…
Changing marker symbols for each level of an interaction using marginsplotHi everyone, I am using Stata 14.2 and the default scheme (s2color) to plot the conditional margina…
help with display of coefficients in a plotwhat could be the problem when one of the coefficients from the linear regression model is not displ…
Returns of different companiesHello, I am new in Stata. I have stock price data of many companies. I would like to get the return…
Subscribe to:
Post Comments (Atom)
0 Response to Generating new variables using an if function
Post a Comment