[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: STATA code for identifying similar observations within group id |

Date |
Mon, 2 Jun 2008 09:49:19 +0100 |

Answers interspersed below. Nick n.j.cox@durham.ac.uk Chirantan Chatterjee About the new in_EE or in_OECD variable which takes 1 or 0, i essentially need a variable irrespective of Pub_nbr observations, that is 1 for any EE inventor or OECD inventor observation - right? Why then do i need the -merge- command, am i missing something here. >>> You don't need the -merge- approach, and I didn't say that you do, but it is a good one. Why it is a good idea and how it works are explained in detail in the two FAQs I directed you towards. About the code: bysort pub_nbr (in_OECD) : gen byte any_in_OECD = in_OECD[_N] == 1 Doesnt this generate a new variable, which takes 1, if all inventors in pub_nbr, stacked one upon another are OECD inventors - whereas i need it to be 1, even when i find just one inventor is from an OECD country. >>> No. The subscript [_N] ensures that you will get precisely what you want. Even if there is only one such inventor, the observation for that inventor will be last within each patent group, given the sort order, so that it will still be true that -in_OECD[_N] == 1-. The command does quite a lot at once. For a tutorial on -by:- see <http://www.stata-journal.com/sjpdf.html?articlenum=pr0004> SJ-2-1 pr0004 . . . . . . . . . . Speaking Stata: How to move step by: step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q1/02 SJ 2(1):86--102 (no commands) explains the use of the by varlist : construct to tackle a variety of problems with group structure, ranging from simple calculations for each of several groups to more advanced manipulations that use the built-in _n and _N About the last variable, i need to do the same, even if one of the patent applicant is from an OECD country - guess if you clarify the above can figure that out for myself. >>> I trust so. * * 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/

**Follow-Ups**:**RE: st: STATA code for identifying similar observations within group id***From:*"Chirantan Chatterjee" <chirantan@cmu.edu>

**References**:**Re: st: STATA code for identifying similar observations within groupid***From:*n j cox <n.j.cox@durham.ac.uk>

**Re: st: STATA code for identifying similar observations within group id***From:*"Chirantan Chatterjee" <chirantan@cmu.edu>

- Prev by Date:
**Re: st: Fracplot after cnreg, intreg and nbreg** - Next by Date:
**RE: st: saving a matrix with rownames** - Previous by thread:
**Re: st: STATA code for identifying similar observations within group id** - Next by thread:
**RE: st: STATA code for identifying similar observations within group id** - Index(es):

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