Page 2 of 2

Re: Transpose

Posted: Fri Nov 13, 2015 8:36 am
by BK03
Also wondering how I would delete all series that have ONLY #N/A's in them. I found some posts about deleting series' with #N/A but this applies to series' with any #N/As

Thank you and happy Friday 13th :wink:

Re: Transpose

Posted: Fri Nov 13, 2015 8:40 am
by EViews Gareth
Hi Glen and Gareth,

I am working on a program and am trying to figure out how to specify a loop command for a particular worksheet in Eviews.

I load in 2 excel worksheets from the same workbook which become separate Eviews tabs. Howver, when I try to execute a loop it does it to both tabs in the EViews workfile!

Many thanks
I don't understand this question.

Re: Transpose

Posted: Fri Nov 13, 2015 8:41 am
by EViews Gareth
Also wondering how I would delete all series that have ONLY #N/A's in them. I found some posts about deleting series' with #N/A but this applies to series' with any #N/As

Thank you and happy Friday 13th :wink:
You can use series.@obs to return the number of non NA values in a series.

Re: Transpose

Posted: Fri Nov 13, 2015 8:59 am
by BK03
Below is the code I use. When I run the series avg_{%h}_bs_{%i} command below it also tries to do this for the second tab (resulting in an error) where it obviously can't find the _bs_ as they are only on the first page.

wfcreate(wf=semi-annual) s 1990 2017
%mypath = @runpath
cd %mypath

'loads first sheet of Excel file where BS data is

pageload(page="Stoxx600_BS") Stoxx600_dataS.xlsx byrow range="EViews1" @freq s 1990s1
pageload(page="Stoxx600_IS") Stoxx600_dataS.xlsx byrow range="EViews2" @freq s 1990s1

'creates average of all variables by dividing totals by number of observations

for %h Cons_Disc Cons_Stap Energy Fin Health Indust IT Mat Telecom Utilities Tot Tot_xFin Tot_xEn Tot_xFE
for %i cash acctrcv invent netfxda totasst LTdebt totliab retearn toteq totlns llrsrv dmddepo STbrrw

series avg_{%h}_bs_{%i} = {%h}_bs_{%i} /{%h}_bs_obs{%i}

next
next

Re: Transpose

Posted: Fri Nov 13, 2015 9:03 am
by BK03
I found this on a previous answer you provided. Does this delete objects with ONLY #N/As.

group g*
for !i=1 to g.@count
%name = g.@seriesname(!i)
if @obs({%name}) = 0 then
d {%name}
endif
next

Re: Transpose

Posted: Fri Nov 13, 2015 9:29 am
by EViews Gareth
Below is the code I use. When I run the series avg_{%h}_bs_{%i} command below it also tries to do this for the second tab (resulting in an error) where it obviously can't find the _bs_ as they are only on the first page.

wfcreate(wf=semi-annual) s 1990 2017
%mypath = @runpath
cd %mypath

'loads first sheet of Excel file where BS data is

pageload(page="Stoxx600_BS") Stoxx600_dataS.xlsx byrow range="EViews1" @freq s 1990s1
pageload(page="Stoxx600_IS") Stoxx600_dataS.xlsx byrow range="EViews2" @freq s 1990s1

'creates average of all variables by dividing totals by number of observations

for %h Cons_Disc Cons_Stap Energy Fin Health Indust IT Mat Telecom Utilities Tot Tot_xFin Tot_xEn Tot_xFE
for %i cash acctrcv invent netfxda totasst LTdebt totliab retearn toteq totlns llrsrv dmddepo STbrrw

series avg_{%h}_bs_{%i} = {%h}_bs_{%i} /{%h}_bs_obs{%i}

next
next
You've explicitly told EViews to load/create a 2nd page. Everything you do after creating that 2nd page will only apply to that page.

Re: Transpose

Posted: Fri Nov 13, 2015 9:30 am
by EViews Gareth
I found this on a previous answer you provided. Does this delete objects with ONLY #N/As.

group g*
for !i=1 to g.@count
%name = g.@seriesname(!i)
if @obs({%name}) = 0 then
d {%name}
endif
next
There's an easy way to find out.