Announcement

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

  • Filling quarterly series backward

    Hi all,

    Could you please help how to fill a quarterly series backward by using the annual growth rate? I have an annual growth rate for quarterly data and the level value in the last observation year. So I want to extend the series backward by using the growth rate data.

    Here is the crude code I tried to do, but it says "is not a valid command name"

    Code:
    forv i = 0/79 {
        replace gdpreal = gdpreal[_N-`i']/((gdpgrw[_N-`i']/100)+1) in [_N-4-`i']
    
    }
    Here is the data. Thank you for your help.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(quarter gdpgrw gdpreal)
    160  4.1044025       .
    161   5.144167       .
    162  4.0468783       .
    163   6.406423       .
    164   3.960815       .
    165   5.056377       .
    166  3.6153526       .
    167  1.6090896       .
    168  2.9461794       .
    169  4.1493363       .
    170    5.09661       .
    171  4.1578083       .
    172    4.67788       .
    173   4.338862       .
    174  4.2635226       .
    175  4.4931536       .
    176  4.0991983       .
    177  4.3877597       .
    178   4.498116       .
    179   7.158496       .
    180   5.964968       .
    181   5.871259       .
    182   5.838213       .
    183   5.106621       .
    184   5.127187       .
    185   4.933375       .
    186   5.864007       .
    187   6.056419       .
    188   6.055137       .
    189   6.726797       .
    190   6.744428       .
    191   5.842161       .
    192   6.218357       .
    193   6.302651       .
    194   6.254865       .
    195   5.282507       .
    196   4.520359       .
    197   4.135784       .
    198  4.2692556       .
    199   5.600275       .
    200   5.989302       .
    201   6.294885       .
    202    5.80689       .
    203    6.80662       .
    204   6.458018       .
    205   6.421766       .
    206    6.25211       .
    207   6.189622       .
    208   6.217451       .
    209   6.273388       .
    210   6.073948       .
    211   6.028776       .
    212    5.76382       .
    213   5.649806       .
    214   5.552942       .
    215   5.618915       .
    216      5.136       .
    217   5.002102       .
    218   4.965033       .
    219   5.036791       .
    220   4.831236       .
    221  4.7403145       .
    222   4.779496       .
    223   5.152625       .
    224   4.943421       .
    225    5.21465       .
    226   5.033505       .
    227   4.938896       .
    228   5.008361       .
    229   5.012552       .
    230   5.064764       .
    231   5.189744       .
    232    5.06912       .
    233   5.269417       .
    234   5.173195       .
    235   5.181314       .
    236   5.061957       .
    237   5.052571       .
    238   5.009831       .
    239   4.955665       .
    240  2.9656055 2703033
    241  -5.323691 2589789
    242  -3.488022 2720492
    243 -2.1665256 2709741
    end
    format %tq quarter

  • #2
    Try:
    Code:
    forv i = 0/79 {
        replace gdpreal = gdpreal[_N-`i']/((gdpgrw[_N-`i']/100)+1) in `=_N-4-`i''
    }

    Comment


    • #3
      Thanks a lot!

      Comment

      Working...
      X