Page 1 of 1

Extracting observations into matrix

Posted: Mon Jan 11, 2016 9:24 am
by YK_Econ
Hi,

I made 3x8 panel regressions. I want to put the number of the observations of each regression into a table. How does this work? My code doesnt work. I think i just need the right @obs command!

Code: Select all

matrix(3,8) observations observations.setrowlabels consumption investment gdp for %dpv c i y for !eqnr= 1 to 8 scalar observations_{%dpv}{!eqnr} = observations_{%dpv}{!eqnr} + {%dpv}{!eqnr}.@obs{%dpv}{!eqnr} observations({%dpv},{!eqnr}) = observations_{%dpv}{!eqnr} next next delete observations*
thank you very much!
best
YK

Re: Extracting observations into matrix

Posted: Mon Jan 11, 2016 9:27 am
by EViews Gareth
I don't understand this line:

Code: Select all

scalar observations_{%dpv}{!eqnr} = observations_{%dpv}{!eqnr} + {%dpv}{!eqnr}.@obs{%dpv}{!eqnr}
Why are you adding the scalar to itself?

Re: Extracting observations into matrix

Posted: Mon Jan 11, 2016 10:17 am
by YK_Econ
sorry that's a bad manner, that I learnt at the beginning of my programming and I still sometimes use it. correct code is

Code: Select all

scalar observations_{%dpv}{!eqnr} = {%dpv}{!eqnr}.@obs{%dpv}{!eqnr}
which still doesnt work :(

Re: Extracting observations into matrix

Posted: Mon Jan 11, 2016 11:33 am
by EViews Gareth
Probably just need:

Code: Select all

scalar observations_{%dpv}{!eqnr} = {%dpv}{!eqnr}.@regobs

Re: Extracting observations into matrix

Posted: Tue Jan 12, 2016 5:11 am
by YK_Econ
thanks! works fine!