Page 1 of 1

Create new series from old series, one value differs

Posted: Wed Jan 19, 2011 7:09 am
by fboehlandt
Hi evereone,
I would like to create a new series in a workfile. The first obervation for that series is fixed (let us say equal to one). All other observations come form a series already in the workfile. I understand I cannot use Genr? Do I need to write a program rotating through the series observations? How do I do that using a simple example?
Here again what I need:

NewSeries(1) = "1"
For i = 2 to LastObservation
NewSeries(i) = Oldseries(i)
Next i

Not an expert on command reference. Any help is appreciated

Re: Create new series from old series, one value differs

Posted: Wed Jan 19, 2011 8:49 am
by EViews Gareth

Code: Select all

genr newseries = oldseries smpl @first @first newseries = 1 smpl @all

Re: Create new series from old series, one value differs

Posted: Fri Jun 24, 2011 5:20 am
by fboehlandt
Hi Gareth,
thank you for your initial response. The code works perfectly. Now I would like to do the same for all series within a group. Let us say the group is named "xs" and is contained in a workfile. For all series within the group I would like to set the first value equal to one and all other values equal to the original value (just as before). The resulting series should be stored in a new group named "xsp". I have tried to come up with a solution for some time now but I am getting nowhere fast. Any help would be greatly appreciated...

Re: Create new series from old series, one value differs

Posted: Fri Jun 24, 2011 7:58 am
by EViews Gareth

Code: Select all

for !i=1 to xs.@count %sername = xs.@seriesname(!i) %newname = %sername + "p" series {%newname} = {%sername} smpl @first @first {%newname} = 1 smpl @all next