Announcement

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

  • convert panel data from annual to monthly data

    Here is my panel data, and I want to convert the dataset from annually to monthly data. So can we realize it in Stata?
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int year float HS_C double imports
    2001  1  274884.3494408275
    2001  2  1173860.892614033
    2001  3  19176.67778363079
    2001  4  237905.8981744647
    2001  5 201572.55051305518
    2001  6  1662974.045675884
    2001  7  947200.2496659309
    2001  8 453066.78361690044
    2001  9 147616.63001669198
    2001 10  751395.1938771606
    2001 11 289937.53890795354
    2001 12 53219.103886432946
    2001 13 132862.01758259535
    2001 14  71213.85291725397
    2001 15 1186207.7291187346
    2001 16  7665952.329377331
    2001 17 2699924.5060536563
    2001 18 1325264.6631108802
    2001 19 1287.9790134429932
    2001 20 125710.83856991306
    2001 21 16456.505226135254
    2002  1 375150.11355054006
    2002  2 1146091.2054727962
    2002  3 42846.693071722984
    2002  4  250536.7052384615
    2002  5 182897.56525558233
    2002  6  2295916.068297306
    2002  7  1130583.924314171
    2002  8  454783.4579089284
    2002  9 248359.97823381424
    2002 10  902129.6992409229
    2002 11  470787.2794511223
    2002 12  40817.89610746503
    2002 13 117144.17476352304
    2002 14  75547.45059922338
    2002 15 1293393.4389997495
    2002 16  8277391.844620407
    2002 17  3706216.326325059
    2002 18 1301605.3796651885
    2002 19  313.9839999675751
    2002 20 119329.95024609566
    2002 21 25293.333457946777
    2003  1  485699.4869878441
    2003  2 3039471.6472938145
    2003  3 106265.25874032639
    2003  4  366948.3697678447
    2003  5 338548.46570368856
    2003  6  2695161.586523395
    2003  7 1450551.5742329434
    2003  8  536954.5006828308
    end
    Thanks in advance!

  • #2
    Why do you want to do this? Two possibilities:

    1. You have other data that are monthly and need to merge, which is fine: that is just a 1:m merge or m:1 merge depending which way round you do it.

    2. You have a rule for imputing monthly values -- other than say dividing by 12 -- in which case the code depends totally on what that rule is. However



    Code:
    search denton 
    to see if that helps.

    Comment


    • #3
      Originally posted by Nick Cox View Post
      Why do you want to do this? Two possibilities:

      1. You have other data that are monthly and need to merge, which is fine: that is just a 1:m merge or m:1 merge depending which way round you do it.

      2. You have a rule for imputing monthly values -- other than say dividing by 12 -- in which case the code depends totally on what that rule is. However



      Code:
      search denton 
      to see if that helps.
      I want to merge with other monthly data. Thanks a lot.

      Comment

      Working...
      X