Hi all,
I have a workfile with oecd data for consumption and several other variables for about 25 countries.
Now I want to delete all series of nafta, g7 and so on.
They are named c_nafta, m_g7, irl_oecd_tot for example.
Therefore I am looking for a command, with which I can delete all series in my workfile that end with _nafta, _g7, _oecd_tot and so on.
I think the command is very simple, however I couldn't find it until now.
Thx, greets
delete several series
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: delete several series
Code: Select all
delete *_nafta
Re: delete several series
do I really have to write
delete *_nafta
delete *_g7
delete *_g20
delete *_oecd_tot
.
.
.
or is there a faster or lets say, more elegant way?
thanks in advance!
delete *_nafta
delete *_g7
delete *_g20
delete *_oecd_tot
.
.
.
or is there a faster or lets say, more elegant way?
thanks in advance!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: delete several series
You could put it in a for loop if you want.
Re: delete several series
exactly, that's what I expected how it works.
unfortunately I am completely new to eviews and therefore have not a clear idea how loops are working. I have the feeling that they can rather change all variables within a certain group. I however would have to delete just certain series which are relatively random spread in the worksheet.
Apart from that, I would really appreciate a link or sth to a nice introduction to loops. what I found until now was really confusing.
ps. I would also need a command to rename all series from gdp_ to y_ , from cons_ to c_ , from exp_ to x , and so on. So obviously another loop, however I have no idea how to do that!
thanks in advance!
unfortunately I am completely new to eviews and therefore have not a clear idea how loops are working. I have the feeling that they can rather change all variables within a certain group. I however would have to delete just certain series which are relatively random spread in the worksheet.
Apart from that, I would really appreciate a link or sth to a nice introduction to loops. what I found until now was really confusing.
ps. I would also need a command to rename all series from gdp_ to y_ , from cons_ to c_ , from exp_ to x , and so on. So obviously another loop, however I have no idea how to do that!
thanks in advance!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: delete several series
The Programming Chapter in the Command and Programming Reference has a pretty good discussion of loops.
In this case, just something like:
In this case, just something like:
Code: Select all
for %j _nafta _g7 _g20 _oecd_tot
delete *{%j}
next
Re: delete several series
Hi Gareth!
I would have a follow up question on that. I realized that I actually need 8 countries out of 35. So is there a loop/program that deletes everything BUT _nafta _oecd_tot _aus .
I think that would be much more comfortable and elegant. Moreover I think it's more clearly when you can see which countries will be left instead of which countries are not interesting.
Thanks for your help!
Best
YK
I would have a follow up question on that. I realized that I actually need 8 countries out of 35. So is there a loop/program that deletes everything BUT _nafta _oecd_tot _aus .
I think that would be much more comfortable and elegant. Moreover I think it's more clearly when you can see which countries will be left instead of which countries are not interesting.
Thanks for your help!
Best
YK
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: delete several series
Just change the list of countries to delete to be the ones you want to delete.
Re: delete several series
well my question would haven been, if there is a code which deletes every series but the countries I choose . In other words, I would like to create a loop, where I name just the countries (=single series) that I want to delete instead of naming the countries I want to delete.
thanks
YK
thanks
YK
-
johansamuelsson
- Posts: 165
- Joined: Thu Mar 03, 2011 10:07 pm
- Contact:
Re: delete several series
Code: Select all
%all = @WLookup("*","Series")
%dontdelete = @WLookup("*_nafta *_oecd_tot *_aus","Series")
%rest = @WDrop(%all,%dontdelete)
Delete {%rest}Who is online
Users browsing this forum: No registered users and 2 guests
