Announcement

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

  • List some few observations of a variable in panel data

    Hello @all,
    I am trying to estimate a panel growth model of 50 countries, using quarterly data from 2001 to 2020.

    My aim is to create block period of time (i.e, 2001-2005, 2006-2010, 2011-2015, 2016-2020) based on my dependent variable(as shown in the model below) and consider each block period as a single observation by taking/listing the first year together with its quarters for each block (i.e, 2001q1, 2001q2, 2001q3, 2001q4, 2006q1, 2006q2, 2006q3, 2006q4, 2011q1, 2011q2, 2011q3, 2011q4, 2016q1, 2016q2, 2016q3, 2016q4)

    (ln(yit-20 )- ln(yit))/20= A + Bln(yit-1) + CX+ uit

    I have already created a column (Growth~e) based on my dependent variable(as can be seen in the table below), since I have an interval of 5 years for each block period, I have divided by 20 the difference ln(f20.yit )- ln(f.yit).
    Click image for larger version

Name:	Screenshot 2024-03-12 at 06.55.37.png
Views:	4
Size:	371.7 KB
ID:	1746350




    Please note that the first few values of Growth~e column are missing entries.

    I am kindly asking if there is a command available that allows me to make some of these observations in that way.

    Kind regards,

    Priel.
    Last edited by Priel Paul; 12 Mar 2024, 06:27.

  • #2
    This article discusses how to bin: https://journals.sagepub.com/doi/pdf...867X1801800311. It is difficult to provide exact code because we do not know whether your dates are quarterly dates or whether they are strings. But an approach would involve passing a quarterly date through the -dofq()- and -year()- functions and subsequently binning.

    Code:
    clear
    set obs 50
    gen qtr= 163+_n
    format qtr %tq
    gen wanted= ceil(year(dofq(qtr))/5)*5

    Res.:

    Code:
    . l, sepby(wanted)
    
         +-----------------+
         |    qtr   wanted |
         |-----------------|
      1. | 2001q1     2005 |
      2. | 2001q2     2005 |
      3. | 2001q3     2005 |
      4. | 2001q4     2005 |
      5. | 2002q1     2005 |
      6. | 2002q2     2005 |
      7. | 2002q3     2005 |
      8. | 2002q4     2005 |
      9. | 2003q1     2005 |
     10. | 2003q2     2005 |
     11. | 2003q3     2005 |
     12. | 2003q4     2005 |
     13. | 2004q1     2005 |
     14. | 2004q2     2005 |
     15. | 2004q3     2005 |
     16. | 2004q4     2005 |
     17. | 2005q1     2005 |
     18. | 2005q2     2005 |
     19. | 2005q3     2005 |
     20. | 2005q4     2005 |
         |-----------------|
     21. | 2006q1     2010 |
     22. | 2006q2     2010 |
     23. | 2006q3     2010 |
     24. | 2006q4     2010 |
     25. | 2007q1     2010 |
     26. | 2007q2     2010 |
     27. | 2007q3     2010 |
     28. | 2007q4     2010 |
     29. | 2008q1     2010 |
     30. | 2008q2     2010 |
     31. | 2008q3     2010 |
     32. | 2008q4     2010 |
     33. | 2009q1     2010 |
     34. | 2009q2     2010 |
     35. | 2009q3     2010 |
     36. | 2009q4     2010 |
     37. | 2010q1     2010 |
     38. | 2010q2     2010 |
     39. | 2010q3     2010 |
     40. | 2010q4     2010 |
         |-----------------|
     41. | 2011q1     2015 |
     42. | 2011q2     2015 |
     43. | 2011q3     2015 |
     44. | 2011q4     2015 |
     45. | 2012q1     2015 |
     46. | 2012q2     2015 |
     47. | 2012q3     2015 |
     48. | 2012q4     2015 |
     49. | 2013q1     2015 |
     50. | 2013q2     2015 |
         +-----------------+
    
    .
    To get a single observation per period, it appears that you want to collapse the data.

    Code:
    help collapse

    Comment


    • #3
      Hi Andrew,

      Thank you for reply, if this help, below is a structure of my data. I am a new Stata user. Thanks for the article, let me check it.



      Attached Files
      Last edited by Priel Paul; 12 Mar 2024, 11:50.

      Comment

      Working...
      X