# st: AW: For each fund-asset pair I have observations on some periods, and want have them on each possible period...

 From "Martin Weiss" To Subject st: AW: For each fund-asset pair I have observations on some periods, and want have them on each possible period... Date Fri, 24 Jul 2009 17:03:59 +0200

```<>

*************
h fillin
h tsfill
*************

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Stata Chris
Gesendet: Freitag, 24. Juli 2009 17:03
An: statalist@hsphsun2.harvard.edu
Betreff: st: For each fund-asset pair I have observations on some periods,
and want have them on each possible period...

Hi Statalisters,

I have the following challenge:

I have a dataset that gives me for each fund-asset-period triple the
quantity and value of holdings (i.e. how much of asset j did fund i
hold in period t).
>From this, I have for each such triple generated the flow (i.e. how
much did the fund buy or sell of a certain asset) from last period
until now.

The problem is that the original dataset does not list holdings or size
zero.
Consequence: If a fund held say 500 units of an asset and then sold
all of these, the respective fund-asset-period observation for the
next period does not exist, so when I compute the flow I get a missing
observation, although it should say flow=-500.
Analogously, if the fund has bought 500 units of an assets after
previously holdings of zero, I would like to have Stata tell me that
the flow equals +500, but instead it will tell me that the flow is
missing.

So I figured the best thing to do, to be on the safe side, would be to
make sure that for each fund-asset pair I have observations on all
periods, rather than just on those for which holdings were listed.

In upshot: My data are currently in long form, with each observation
being a unique fund-asset-period triple. However, for each fund-asset
pair I have observations on some but not all of up to 60 periods. The
question is: How can I add observations such that for each pair there
is an observation on each of the 60 periods (some of which may only
have missing values, but they need to be listed)?

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