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

st: RE: Clarification of prior message


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Clarification of prior message
Date   Wed, 23 Oct 2002 20:28:58 +0100

Hoetker, Glenn
> 
> Until I got a received the copy of the message I just sent 
> out, I didn't
> realize how the formatting could get messed up.  Since that 
> could make
> the nature of my problem somewhat unclear, let me repost 
> it, with some
> slight reformatting.  My apologies for any possible 
> confusion. --Glenn
> 
> ----
> 
> 
> Hoping someone can help me with a problem involving dividing up a
> variable. My data consists of patent numbers (wku) and 
> inventors (nmi)
> and looks like this:
> 
> Record 1
> NMI: Schmitt, Ty; Gandre, Jerry   WKU: 5586003
> 
> Record 2
> NMI: Sato, N. Albert; Baker, David C.; Waldron, Christie J.	  WKU:
> 5586324
> 
> Record 3
> NMI: Swamy, N. Deepak	WKU: 5587885
> 
> I would like it to look like this:
> 
> nmi				wku 
> Schmitt, Ty 		5586003
> Gandre, Jerry		5586003
> Sato, N. Albert 		5586324
> Baker, David C. 		5586324
> Waldron, Christie J.	5586324
> Swamy, N. Deepak		5587885
> 
> That is, I want to create a record containing each inventor 
> and his or
> her associated patent number.  If Ty Schmitt had five 
> patents, he should
> show up in five records.  The number of inventors per 
> patent varies from
> one to many.
> 
> I've looked for egen functions (and their extensions) and done some
> experimenting, but am floundering.  Any help would be very 
> appreciated!
> 

Shucks. See my previous posting, and do something like this: 

. split nmi, p(;) 
. drop nmi 
. gen id = _n 
. reshape long nmi, i(id) 
. drop if nmi == "" 

Nick 
n.j.cox@durham.ac.uk 
*
*   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