Statalist


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

st: AW: creating a variable from many variables


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: creating a variable from many variables
Date   Tue, 6 Oct 2009 13:29:17 +0200

<> 

Also note Nick`s recent column
http://www.stata-journal.com/article.html?article=pr0046




HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Rajaram
Subramanian Potty
Gesendet: Dienstag, 6. Oktober 2009 12:52
An: [email protected]
Betreff: st: creating a variable from many variables

 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/


*
*   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