Statalist The Stata Listserver


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

Re: st: Please Help How to Summarize Data - Revised Version


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Please Help How to Summarize Data - Revised Version
Date   Mon, 1 Jan 2007 12:00:08 +0000 (GMT)

--- Scott Hill <[email protected]> wrote:
> My intention is to count the number of firms which received
> financing from at least 2 investors per stage and summarize the
> results in terms of stages and in terms of years.  This type of
> financing is called syndicated financing. As an example, in terms of
> stage number, I will have 2 firms (firms B and D) as my count of
> firms which received syndicated financing in the 1st stage.  I will
> have 1 firm (firm A) as my count of firms which received syndicated
> financing in the 2nd stage. A total of 3 firms (A, B, and D) received
> syndicated financing. In terms of years, it took firm A 0.5 years, 
> from 1 Oct 96 (1st stage) to 1 Apr 97 (2nd stage) to get syndicated
> financing. A mistake I made is that I should note that it took 0
> years (not 1 year) for firms B and D to get syndicated financing, as
> they got it at the very beginning (1st stage).

Scott:	
In order to get what you want it is sometimes easier to temorarily
loose parts of your data, for instance the duplications of firms in
your dataset. You can do that temporarily with the command -preserve-
and -restore-. This is what I have done the example below. 

Copy anything between *-------- begin example ----- and 
*---------- end example ------, and past it in the do-file editor (see:
-help doedit-). Than you can run the example. If you don't understand a
line you can look at the appropriate helpfiles, e.g.: -help date- (to
get the string date into Stata dates), -help by- and -help _variables-
(to understand the line -by Firm Stage: keep if _n==1-), -help table-,
and -help collapse-.

Hope this helps and Happy new year,
Maarten

*------------------ begin example --------------------
/* getting the data in Stata */
clear
input str1 Firm     Stage         Investors   str9 Date               
  A           1                      1            " 1 Oct 96"
  A           2                      2            " 1 Apr 97"
  A           2                      2            " 1 Apr 97"
  B           1                      2            "28 Mar 01"
  B           1                      2            "28 Mar 01"
  C           1                      1            " 1 Feb 01"
  C           2                      1            " 1 Feb 02"
  C           3                      1            " 1 Feb 03"
  D           1                      3            "15 May 95"
  D           1                      3            "15 May 95"
  D           1                      3            "15 May 95"
end

gen stdate = date(Date, "dmy", 2040)
format stdate %td

/* duplicates are unnecesary and complicating for this task */
/* so I loose them, but I use -preserve- so I can -restore- */
/* the data when I am done */
sort Firm Stage

by Firm Stage: keep if _n==1


/* table of count syndicated by stage */

gen syndicated = Investors >=2
table Stage, c(sum syndicated) row

/* duration till syndicated */
gen firstsyn = stdate if syndicated == 1
format firstsyn %td
collapse (min) stdate firstsyn, by(Firm)
gen time = firstsyn - stdate
list

restore
*---------------------- end example ------------------------


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com 
*
*   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