Those respondents who have given an exact answer have value 98 in income_2, whereas all who have given a categorized answer have a value less than that (say, from "1" for "0 to 300 Euros" to 15 for "more than 10,000 Euros"). Let's assume that the exact answers are stored in variable income_1 and the categorized answers in income_2. If they do not want to give an exact figure, they are asked whether their income is within a certain income bracket this often triggers a considerable number of additional, albeit somewhat less exact, answers. Consider the following real-life example: In surveys, respondents are often asked about their income. The previous sentence shows, even though implicitly, that generate and replace can be combined with an if clause (just as almost any other Stata command can). In this case, you will have to refer to the variable by replace in all subsequent steps. For instance, you may first define a new variable with generate and then modify it for a subset of cases (i.e. But replace is needed not infrequently if you cannot or do not want to create a new variable in a single rush. Whether or not it makes sense to do something like this is up to you. Even though this is not typical, this variable may also appear on the right hand side of the "equals" sign, such as in: Of course, operators and other arguments may be combined, and parentheses can be used to clarify the order in which operators are supposed to work.Ĭommand replace works the same way, except that on the left side of the "equals" sign a variable is named that is already present in your data set. That is, a variable "per capita income" is created by dividing the total income by the number of household members. But most of the time "expression" will contain mathematical operators, such as in the following example: negative values will be turned into positive ones. Will return the absolute value of variable distance, i.e. "Expression" can be a mathematical argument. Still, this entry is rather lengthy.įor once, let me start with a general formulation of the syntax:
STATA 13 COMMANDS LIST SOFTWARE
Note that modern statistical software offers a tremendous range of possibilites, and a brief guide like mine cannot do justice to all of them. For beginners, it may be important to bear in mind that the moment a variable is generated, it exists therefore, even a variable that has just be created via generate, in the next step has to be addressed by replace.
STATA 13 COMMANDS LIST PLUS
To create new variables (typically from other variables in your data set, plus some arithmetic or logical expressions), or to modify variables that already exist in your data set, Stata provides two versions of basically the same procedures: Command generate is used if a new variable is to be added to the data set, whereas replace, obviously enough, is used to replace an old (= already existing) variable.
the value of X is related to the value of the square root of X. Then have margins realize that functions of the same variable are related to each other, e.g. the log of a variable, the cube root, whatever.
I'd like to be able to specify more functions of independent variables, e.g. I'd like to have margins do it with one command. After commands like ologit and mlogit, you have to run a separate margins command for each outcome of the dependent variable. Stats geniuses might already realize this, but for the rest of us some sort of at least brief explanation would help.īetter support for margins with multiple outcome commands. The answer is usually that some option is not appropriate given the technique used. Panel data techniques seem especially problematic. People are always asking why margins does or doesn't do this or that after some command. Having all the wishes compiled in a single thread might be helpful.Ĭommand specific help for margins (or else some FAQs).
As far as I can tell, nobody else has started a thread like this on the new board, so I figured I would go first.