Hi
I have a small query. I am trying to generate a new variable (X), based on my existing 3 variables (A, B and C). I want the new variable X to equal A if A has a non-missing value. In case of A's value is missing, then X should equal B, if however if B's value is missing then X should equal C's value. I tried using if and else if commands but I am not being able to execute it properly. Kindly share any help or suggestions. Thank You.
Related Posts with Generating a new variable on non-missing condition
DMARIANO in stata: Diebold_Mariano test: basic questiondmariano (written by Christopher Baum; ssc install dmariano) performs the Diebold_Mariano test for p…
Identifying differences in a variable within a datasetI have a dataset that has data that is pooled across different years. At the moment, I would to lik…
Significant difference between two metric variablesWe have made a pre-test and asked respondents to evaluate the direction and strength of 7 arguments …
Distribution of frequency of a unique variableHi everyone I am relatively new to STATA. I have the following problem I cannot solve: Given my dat…
Cross-sectional regressionDear all, I would like to get the residual of cross-sectional regression for every industry-year com…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a new variable on non-missing condition
Post a Comment