Extracting observations into matrix

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

YK_Econ
Posts: 36
Joined: Wed Jan 28, 2015 8:34 am

Extracting observations into matrix

Postby YK_Econ » Mon Jan 11, 2016 9:24 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Extracting observations into matrix

Postby EViews Gareth » Mon Jan 11, 2016 9:27 am

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?

YK_Econ
Posts: 36
Joined: Wed Jan 28, 2015 8:34 am

Re: Extracting observations into matrix

Postby YK_Econ » Mon Jan 11, 2016 10:17 am

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 :(

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Extracting observations into matrix

Postby EViews Gareth » Mon Jan 11, 2016 11:33 am

Probably just need:

Code: Select all

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

YK_Econ
Posts: 36
Joined: Wed Jan 28, 2015 8:34 am

Re: Extracting observations into matrix

Postby YK_Econ » Tue Jan 12, 2016 5:11 am

thanks! works fine!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests