I thought the poster was unambiguous about wanting to change
the database in the strong sense - he exhibits a "New data base"
which does not contain observations for years where there are
no forward values.
Though as long as he is content with the results, I suppose
any ambiguities - his, mine, yours - are irrelevant, eh?
thanks,
Jeph
Nick Cox wrote:
I was ambiguous, but in a way often 
used in Stata circles. 
Changing the data in the strong sense
includes -drop-ping observations, as 
this is irreversible, unless by 
going back to the original dataset. 
Changing the data in the weak sense
includes any -generate- of a new
variable. That is reversible, as
the new variable can be -drop-ped
and re-created at will assuming 
no changes of the data in the 
strong sense. 
Others have explained F. 
Nick 
[email protected] 
Jeph Herrin
 
According to his original post, he wanted to change
his data. But the point about the gaps is well taken.
what is "F."? other than the F density.
Nick Cox wrote:
This changes your data and assumes no 
gaps. Using -tsset- and F. is a  
better way to do it. 
Jeph Herrin
  
Try
  gen profits1=profits
  bys firms (years): gen profits2=profits[_n+1]
  bys firms (years): gen profits3=profits[_n+2]
  drop if profit2==.
irodriguez
i need to generate some columns data in excel I think I 
could calculate 
them in stata
I have a panel data with firms, and profits for the period 
1990/2004 No 
all the firms have the same period of data
I need to calculate others 4 columns for profit
superposing a rolling period window of 3 periods.
Example:
original data base
Firms    Years   Profits   
firm 1     1990     7
firm 1      1991     9
firm 1      1992      2
firm 1      1993       6
firm 1       1994      5    
firm 1       1995     4
firm 2      1990      3
firm 2      1991      2
firm 2      1992      1
firm 2       1993     3
...
 
New data base
Firms    Years   Profits1    Profit2   Profit3   
firm 1     1990     7                9         2
firm 1      1991     9               2         6
firm 1      1992      2              6         5
firm 1      1993       6            5          4
firm 2      1990      3             2           1
firm 2      1991      2              1          3
*
*   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/
*
*   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/