tables

For questions regarding programming in the EViews programming language.

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

mark
Posts: 37
Joined: Thu Mar 12, 2009 3:27 pm

tables

Postby mark » Thu Feb 03, 2011 3:51 pm

Hi - eviews 7.1
I have a large panel data set - trying to write a program to extract and save summary data on two variables over six regions.
I'm able to it to run through region_map "1" and produce the necessary tables but don't know how to dump the values when it loops throught he following regions. Any help appreciated

for %var avg_px qty
for %region_map 1 2 3 4 5 6
%name = "tab" + %var +%region_map
freeze({%name}) {%var}.statby(min,max,mean,med) test
show {%name}
next
next

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

Re: tables

Postby EViews Gareth » Thu Feb 03, 2011 4:13 pm

I'm not sure what you're asking here. Which values are you trying to "dump", and where are you trying to dump them to?

mark
Posts: 37
Joined: Thu Mar 12, 2009 3:27 pm

Re: tables

Postby mark » Thu Feb 03, 2011 4:48 pm

trying to generate tables for avg_px and qty for each of six regions. So the program below takes avg_px and region_map 1, generates a table, then loops back to gernerate a table fo qty for region_map 1.
Where I have problems is when it loops back to pick up region_map 2. The program crashes - I believe it may be because the tables generated by the loop 1 still exist. Can you suggest how I can modify the code so that it will generate a unique table for each varaible for each of the six regions?



for %var avg_px qty
for %region_map 1 2 3 4 5 6
%name = "tab" + %var +%region_map
freeze({%name}) {%var}.statby(min,max,mean,med) test
show {%name}
next
next


I need to save the tables

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

Re: tables

Postby EViews Gareth » Thu Feb 03, 2011 4:56 pm

It runs fine for me on some generated data:

Code: Select all

create u 100 series avg_px = nrnd series qty = nrnd series test = nrnd>0 for %var avg_px qty for %region_map 1 2 3 4 5 6 %name = "tab" + %var +%region_map freeze({%name}) {%var}.statby(min,max,mean,med) test show {%name} next next

mark
Posts: 37
Joined: Thu Mar 12, 2009 3:27 pm

Re: tables

Postby mark » Fri Feb 04, 2011 9:49 am

hi
thanks for the code - works fine however the tables generated contain the same data on the two variables as the program loops through the 6 regions. I do get twelve tables - but the data for each set of tables (2 per region) are identical for the stats on avg_px and qty. I've included an example below on the the tabs reported for region 1 - avg_px and region 2 - av_px - they are identical but should not be.

thanks:

For Region 1

Descriptive Statistics for AVG_PX
Categorized by values of TEST
Date: 02/04/11 Time: 08:43
Sample: 1 140400
Included observations: 195

TEST Mean Median Max Min. Std. Dev. Obs.
2005:2 55.65250 57.17500 58.50000 49.76000 4.064770 4
2005:3 107.8125 108.1250 120.0000 95.00000 10.25381 4
2006:2 92.98476 82.00000 231.4000 52.31000 38.12117 21
2007:2 62.78563 79.00000 133.1000 13.26000 41.03393 16
2007:3 107.4600 84.10000 215.0000 74.20000 53.13751 10
2008:2 60.25421 88.65000 151.0000 7.400000 48.09119 19
2008:3 64.24375 65.14000 109.0000 15.05000 44.44040 8
2008:4 176.0625 171.5000 202.0000 150.0000 18.85743 8
2009:4 103.3106 99.62500 124.3000 88.00000 12.16452 16
2010:2 84.95046 89.00000 185.0000 13.75000 34.80478 65
2010:3 191.7825 181.5000 500.0000 66.00000 141.9121 24
All 100.1565 90.00000 500.0000 7.400000 72.38369 195

for Region 2

Descriptive Statistics for AVG_PX
Categorized by values of TEST
Date: 02/04/11 Time: 08:43
Sample: 1 140400
Included observations: 195

TEST Mean Median Max Min. Std. Dev. Obs.
2005:2 55.65250 57.17500 58.50000 49.76000 4.064770 4
2005:3 107.8125 108.1250 120.0000 95.00000 10.25381 4
2006:2 92.98476 82.00000 231.4000 52.31000 38.12117 21
2007:2 62.78563 79.00000 133.1000 13.26000 41.03393 16
2007:3 107.4600 84.10000 215.0000 74.20000 53.13751 10
2008:2 60.25421 88.65000 151.0000 7.400000 48.09119 19
2008:3 64.24375 65.14000 109.0000 15.05000 44.44040 8
2008:4 176.0625 171.5000 202.0000 150.0000 18.85743 8
2009:4 103.3106 99.62500 124.3000 88.00000 12.16452 16
2010:2 84.95046 89.00000 185.0000 13.75000 34.80478 65
2010:3 191.7825 181.5000 500.0000 66.00000 141.9121 24
All 100.1565 90.00000 500.0000 7.400000 72.38369 195




Do you have a suggestion on how to clear the values in the tables as the program loops across the regions?

thanks

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

Re: tables

Postby EViews Gareth » Fri Feb 04, 2011 9:53 am

Again, it really isn't clear what you're asking here.

Your original code just did a statsby on a variable called %var. The loop only looped through two variables, avg_px and qty, thus you'll only ever get two sets of values in the tables, since you are only performing the statsby on two variables.

It isn't clear what more you want to do.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests