Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: RE: problem with commands


From   "Vassilopoulos Achilleas" <vassilopoulos.statalist@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: problem with commands
Date   Wed, 8 Sep 2010 00:01:16 +0300

And this can keep going on forever... any ideas why my posts seem not to
like ENTER????
I just saw that also my "corrected" post appeared the same way...

Thanks,

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Vassilopoulos
Achilleas
Sent: 07 September, 2010 23:53
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: problem with commands

Sorry, I've just found out that some lines in my previous post did not
appeared separated so I thought I should repost.

I think this is what you're looking for :

cd "YOUR_DIRECTORY"

gen firstsic_sub=int(sic_sub/100)
gen firstsic_moth=int(sic_mother/100)
gen twosic_sub=int(sic_sub/10)
gen twosic_moth=int(sic_mother/10)

capture erase new.dta
tempname new
postfile `new' str10 id_mother year double diver using new

levelsof year_inc_sub, local(levels)
foreach y of local levels {

count if (year_inc_sub<=`y') & (firstsic_moth!=firstsic_sub) 
scalar digit=r(N) 
count if year_inc_sub<=`y'
scalar total=r(N)
scalar a=scalar(digit)*3/scalar(total)
count if (year_inc_sub<=`y') & (firstsic_moth==firstsic_sub)
scalar digit2=r(N) 
scalar b=scalar(digit2)*2/scalar(total) 
count if (year_inc_sub<=`y') & (twosic_moth==twosic_sub) 
scalar digit3=r(N) 
scalar c=scalar(digit3)*1/scalar(total) 
scalar all=scalar(a)+scalar(b)+scalar(c)

post `new' ("X") (`y') (scalar(all))
scalar drop all digit total
}

postclose `new'
use new, clear
sort year


Hope this helps,
_____________ - _______________

Achilleas Vassilopoulos

Agricultural University of Athens,
Dept. of Agricultural Economics and Rural Development, Lab. of Political
Economy and European Integration.
Iera Odos 75, 11855, Athens, Greece

Tel: (+30) 210-5294726
Fax: (+30) 2105294786
Email : avassilopoulos.aua@gmail.com 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of ???s???a
G?a?????p?????
Sent: 07 September, 2010 13:49
To: statalist@hsphsun2.harvard.edu
Subject: st: problem with commands

Dear Statalisters,

I have a data set consisting of a number of companies which are all
subsidiaries of the same company X. The following variables describe
each of these companies and their mother company:
1) "id_mother", the identity of the mother company
2) "id_sub", the identity of the subsidiary company
3) "year_inc_sub", year of incorporation of the subsidiary
4) "SIC_mother", a 3-digit industry classification code for the mother
5) "SIC_sub", a 3-digit industry classification code for the subsidiary

The dataset looks like this:

id_mother     sic_mother     id_sub          sic_sub           year_inc_sub
X                  731               JP0JPN         738
1982

X                  731               JP680JPN      737
2002

X                  731               JP0JPN         899
2002

X                  731               JP0JPN         355
1953

X                  731              JPJPN            355
      2001

X                  731              JPN                502
          1972

X                  731             JPJPN              357
           1960


Based on this information I want to create a new dataset with a
time-series structure, which will refer to the mother company "X" for
the period 1990-2005. In the new dataset I want to have the following
variables:
1) "id_mother", as above;
2) "year", the year of the observation;
3) "diversification", a new variable whose estimation I explain below.

The diversification variable should be created under the following logic:
For observation in year 1990 the value of diversification should be
the sum of a, b, and c below:

a) take the total number of subsidiary companies which were
incorporated in 1990 or earlier whose 1st digit of sic_sub is
different than the 1st digit of sic_mother and multiply them by 3;
divide this number by the total number of companies which where
incorporated in 1990 or earlier (in the example, the total number of
companies existing in 1990 is 4)
b) take the total number of subsidiary companies which were
incorporated in 1990 or earlier for which only the 1st digit of their
sic_sub is the same as the 1st digit of sic_mother and multiply them
by 2; divide this number by the total number of companies which where
incorporated in 1990 or earlier
c) take the total number of subsidiary companies which were
incorporated in 1990 or earlier, whose 1st and 2nd digits of sic_sub
are the same as the 1st and 2nd digits of sic_mother but they differ
in the 3rd digit, and multiply them by 1, divide this number by the
total number of companies which where incorporated in 1990 or earlier

The same logic should apply for the observations for years 1991-2005

The expected dataset should look like this:

id_mother    year      diversification
X                1990      a+b+c when subsidiaries incorporated
earlier than or equal to 1990
X                1991      a+b+c when subsidiaries incorporated
earlier than or equal to 1991
X                1992     a+b+c when subsidiaries incorporated earlier
than or equal to 1992
X
............................................................................
................................
X                2005     a+b+c when subsidiaries incorporated earlier
than or equal to 2005
- Hide quoted text -


Thank you in advance.

Chrysa

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


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index