Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: creating a variable from many variables


From   Rajaram Subramanian Potty <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: creating a variable from many variables
Date   Tue, 6 Oct 2009 16:21:50 +0530

 Dear all,
I have about 6 variables and I want to create a variable based on all
these variables. If the all the variables take a particular value, I
want to generate the variable as 1 otherwise 0. The problem is that
for some of the cases some variables will not be applicable. The
following is an example of the data for 10 cases. In the follwing
example if the value of all the applicable variables is 4 then a
created variable is 1 otherwise it is 0 as shown below.

var1	var2	var3	var4	var5	var6	createdvar
4	.	4	4	4	.	1
2	4	.	.	.	.	0
4	4	4	4	4	4	1
2	3	4	4	4	4	0
4	4	4	4	4	4	1
4	.	.	.	.	.	1
3	3	3	3	3	3	0
4	3	.	.	.	.	0
2	3	1	4	3	.	0
1	1	.	.	.	.	0

Thanks and regards,

RAJA

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index