Page 1 of 1

Generate series with constant values

Posted: Tue Jul 14, 2015 8:31 am
by ecardamone
Hi,

I hope someone can help me figure out how to program the following.

I have over 70 series from 1980-2013. I need each series spliced such that observations from 2014-2020 are constant and take the value observed in 2013. The series are named something like cfc110, cfc135, cfc529, etc. Is there a way to loop this so that I don't have to list all the unique characters for each series? I know I could do something like

smpl 2014 2020
for %x 110 135 529
genr cfc{%x} = cfc{%x}(-1)
next

But since I have more than 70 series with more complicated unique characters, is there a different, better way to do this?

Thanks so much for help!

Re: Generate series with constant values

Posted: Tue Jul 14, 2015 9:11 am
by EViews Gareth
Put the series in a group, then loop through the elements of the group one at a time.

Code: Select all

For !i = 1 to mygrp.@count %name = mygrp.@seriesname(!i) 'Stuff here Next

Re: Generate series with constant values

Posted: Thu Sep 17, 2015 7:33 am
by ecardamone
Thank you! This is a much more efficient way to do it. Thanks, again.

Code: Select all

smpl 2014 2025 for !i=1 to resids.@count %name = resids.@seriesname(!i) series {%name} = {%name}(-1) next