Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Estimate mean

    Dear all,

    I have a panel-dataset from 2000-2010 with round about 100 firms. Each firm has an Identifier (ID).
    I want to measure the average SD for a variable (Profit) within industries. Each industry is defined by the first number of the SIC-Code (SIC1).
    The data is xtset, Cluster-variable=ID, t=1 year and the data is in long-format.
    The problem is not really to measure the average SD and the number of nonmissing observations, but to get the number of clusters (firms).
    I did my calculation in two steps:
    First: SD for Profit by firm:
    egen SD_Profit=sd(Profit) if Profit!=., by(ID)
    In the second step, I calculate the weighted mean (automatically by the number of Profit observations). I tried several strategies. For example:
    .tempfile indSD
    .statsby obs=e(N) meanSD=_b[SD_Profit], by(SIC1): mean
    .save indSD,replace
    The pdf-documenation tells me, the the mean-command stores the number of cluster in a scalar, but I guess it belongs to the standardization auf the mean….
    I want to know how many firms are involved in the calculation…
Working...
X