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
Create new series from old series, one value differs
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
fboehlandt
- Posts: 83
- Joined: Thu Apr 15, 2010 3:54 am
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Create new series from old series, one value differs
Code: Select all
genr newseries = oldseries
smpl @first @first
newseries = 1
smpl @all
-
fboehlandt
- Posts: 83
- Joined: Thu Apr 15, 2010 3:54 am
Re: Create new series from old series, one value differs
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...
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...
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Create new series from old series, one value differs
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
Who is online
Users browsing this forum: No registered users and 2 guests
