Hi Everyone,
I am facing difficulties regarding labeling values while creating a new variable...
I have created a variable using more than two variables and I want that the newly created variable can be directly labeled from the variables used to construct the new variable. Let me give you a precise example to further clarify the issue.
Let’s assume that I have five variables named var1, var2 …. Var5. Var1 has only one response i.e., 1, and is labeled as “Unmarried”, similarly, var2 has only one response i.e., 2, and is labeled as “Currently married”, similarly, var3 has only one response i.e., 3, and is labeled as “Divorced”, likewise, var4 has only one response i.e., 4, and is labeled as “Separated”, & finally, var5 also has only one response i.e., 5, and is labeled as “Widowed”.
I have used the following command for generating marital status variable,
gen mar_st = max(var1, var2, var3, var4, var5)
The variable is constructed perfectly with responses 1,2,3,4 and 5. But the problem is I have to use label define and then label all the values to get the variable in a better/perfect shape for my analysis.
The real problem is in my analysis I have to use almost 8, 10, 12, or more variables to create a single variable. I have been looking for a solution but no luck and then I thought to reach you for help.
Thanking in anticipation....
I am facing difficulties regarding labeling values while creating a new variable...
I have created a variable using more than two variables and I want that the newly created variable can be directly labeled from the variables used to construct the new variable. Let me give you a precise example to further clarify the issue.
Let’s assume that I have five variables named var1, var2 …. Var5. Var1 has only one response i.e., 1, and is labeled as “Unmarried”, similarly, var2 has only one response i.e., 2, and is labeled as “Currently married”, similarly, var3 has only one response i.e., 3, and is labeled as “Divorced”, likewise, var4 has only one response i.e., 4, and is labeled as “Separated”, & finally, var5 also has only one response i.e., 5, and is labeled as “Widowed”.
I have used the following command for generating marital status variable,
gen mar_st = max(var1, var2, var3, var4, var5)
The variable is constructed perfectly with responses 1,2,3,4 and 5. But the problem is I have to use label define and then label all the values to get the variable in a better/perfect shape for my analysis.
The real problem is in my analysis I have to use almost 8, 10, 12, or more variables to create a single variable. I have been looking for a solution but no luck and then I thought to reach you for help.
Thanking in anticipation....

Comment