Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Question on data manipulation


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Question on data manipulation
Date   Fri, 21 Oct 2005 08:35:44 -0400

A slight fix to the code already offered:

bysort firm (characteristic): gen dummy = _N > 1
bysort firm innovation (dummy): replace dummy = dummy[_N]

This code assumes that a given innovation won't be listed with the same characteristic more than once.

Michael Blasnik
michael.blasnik@verizon.net

----- Original Message ----- From: "Susanne und Ulrich Kohler" <suli.kohler@web.de>
To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, October 21, 2005 7:15 AM
Subject: Re: st: Question on data manipulation



On Friday 21 October 2005 11:48, Andre pierre wrote:
I have a question, for which the answer might be simple, but I did not find
it yet.
I am working on a datset that contains information on innovating firms. My
question might be more understandable with the following example:
Firm 1 has 3 innovations (A, B and C). A and B have one caracteristic in
common (x); B and C have another caracteristic in common (g), while
Innovation D does not have the same caracteristic as any of the other
innovations.
I would like to create a dummy that takes the value one if an invention by
a given firm has at least one caracteristic in common with one of the other
innovations by the the same firm. My question is how can I get this dummy?

<snip>
. by firm (charateristic): gen dummy = _N > 0
. by firm innovation (dummy): replace dummy = dummy[_N]

--
kohler@wz-berlin.de
+49 (0)30 25491-361
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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