How to copy and paste consecutive values into series

For questions regarding programming in the EViews programming language.

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

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

How to copy and paste consecutive values into series

Postby neptunhiker » Sat Aug 24, 2013 2:18 am

Hi everyone,

I beliebe I am having a syntax problem. I would like to copy a few consecutive values from one series into another. If you look at the code below you will understand what I would like to do. Thanks for your help.

Code: Select all

create d5 2012 2013 series x=@trend series y=rnd ' How to put 5 consecutive values of series x starting at row 106 into series y at row 17? ' For one value it's trivial like: y(17)=x(106) 'Here is my idea that does not work y(17)=x(106:110)

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: How to copy and paste consecutive values into series

Postby startz » Sat Aug 24, 2013 7:17 am

Code: Select all

smpl 106 110 y = x smpl @all
eta: Not quite. See Gareth's version below.
Last edited by startz on Sat Aug 24, 2013 10:54 am, edited 1 time in total.

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

Re: How to copy and paste consecutive values into series

Postby EViews Gareth » Sat Aug 24, 2013 10:50 am

Actually, I think something like:

Code: Select all

smpl 17 21 y = x(89)

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

Re: How to copy and paste consecutive values into series

Postby neptunhiker » Mon Aug 26, 2013 2:35 am

Hi Gareth,

That's a nice way to solve it. Thanks.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: How to copy and paste consecutive values into series

Postby EViews Glenn » Mon Aug 26, 2013 8:27 am

For dated data where you may not know the index of the element of interest, you can do something like

Code: Select all

smpl 2000 2012 y = @sum(x, "1980 1980") smpl @all


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests