(Comments)

Manipulate unbalanced

As I promised before in the video about manipulating the unbalanced panel data, hereby the code, that previously is not accepted by Youtube because Youtube policy to not have the bracket "(" in the description. 

Step by step in manipulate unbalanced panel data 

The video if you are curious is here 

How to manipulate unbalanced panel data video 

And the code is here 
Unbalanced panel data and screening 

xtdes
Local maxis = r(max)
By company: generate obs = _N
Drop if abs < 'maxis'

xtdes

//removing just some of them
Tsspell year, cold (d.year ==1)
Even spell = max(_spell), by (company)
Drop if nspell >1

//Or if we want to delete som specificities that has bigger in loss
Tsspell year, cond(D.year==1)
Replace _spell =F._spell if _spell ==0
Even maxspell = max(_seq+1), by (company _spell)
Drop if maxspell <5

xtdes


The unbalance panel data can be happen because 

Current rating: 5

Comments