Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Question about fillin


From   André Gyllenram <[email protected]>
To   <[email protected]>
Subject   st: Question about fillin
Date   Thu, 14 Feb 2013 15:16:34 +0100

Hello,

I have a question about the command fillin.

It is not possible to combine this with by. But can you do in some other way?

I would like to write like this:

by individual: fillin individual stock period.


My data looks like this;

INDIVIDUAL    STOCK   PERIOD  
1             C        1  
1             E        1
1             A        2
1             F        2

2             G        1
2             H        1
2             I        2
2             K        2

And I would like to add observations with missing data so that in every time period there is a row for all stocks that the individual owns in any period. Individual 1 owns 
stock C, E, A and F in period 1 or 2. This means that i want a row for these stocks in every time period for individual 1. 

Individual 2 owns stock G, H, I an K in period 1 or 2. So for every time period I want a row for these stocks for individual 2. In this example I want to add observations so the data looks like this:


INDIVIDUAL   STOCK   PERIOD
1            A       1
1            C       1
1            E       1
1            F       1
1            A       2
1            C       2
1            E       2
1            F       2 
   
2            G       1
2            H       1
2            I       1
2            K       1
2            G       2
2            H       2
2            I       2
2            K       2

So in this example I want to add 8 rows. If I write fillin individual period I would add much more rows than i want to since the individuals together own stocks A, C, E, F, G, H, I 
and K.


Anyone knows how to do this?

Kind regards 
André Gyllenram


  






 		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index