Statalist The Stata Listserver


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

RE: st: RE: data management problem


From   "Wanli Zhao" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: data management problem
Date   Sun, 6 May 2007 08:43:26 -0400

Thanks again, Maarten. I think I got it another (maybe) easier way.

gen product1=product
replace product1=product1[_n-1]+", "+product if firm==firm[_n-1]

Then the last product1 within each firm is the product list. I am not sure
if I am 100% right.

Willie

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Maarten buis
Sent: Sunday, May 06, 2007 6:59 AM
To: [email protected]
Subject: RE: st: RE: data management problem

I was about to leave for a walk, but two quick suggestion:

Starting by copying the example I sent and than generalizing it step by
step to your data is typically easier to debug. The example works, so
you can quickly see at which step the error occurs. 

Yes, it doesn't take care of repeated values. It probably quite easy to
do that by using one or more of the string functions, see: 
-help string functions-.

Hope this helps,
Maarten

--- Wanli Zhao <[email protected]> wrote:

> I tried the solution and I got some errors. First it says local
> option not
> allowed. Then I change the Ndepts to a variable I have which is the
> number
> of departments for each firm. Still does not work. Also it says my
> dataset
> is already wide.
> It also seems that the code does not take into account of repeated
> values in
> products. I am not sure about blanks in product column. Any
> suggestions?
> Willie
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Maarten
> buis
> Sent: Sunday, May 06, 2007 5:14 AM
> To: [email protected]
> Subject: Re: st: RE: data management problem
> 
> --- Wanli Zhao <[email protected]> wrote:
> > The data looks like follows:
> > 
> > firm	dept	product
> > 1	a	a, b
> > 1	b	c, r
> > 1	c	d, a
> > 2	d	d, f
> > 2	e	I, y
> > 2	f	g

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index