Generate series with constant values

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ecardamone
Posts: 40
Joined: Wed Sep 17, 2014 12:23 pm

Generate series with constant values

Postby ecardamone » Tue Jul 14, 2015 8:31 am

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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Generate series with constant values

Postby EViews Gareth » Tue Jul 14, 2015 9:11 am

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

ecardamone
Posts: 40
Joined: Wed Sep 17, 2014 12:23 pm

Re: Generate series with constant values

Postby ecardamone » Thu Sep 17, 2015 7:33 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests