Creating a table with @pcy in a row

For questions regarding programming in the EViews programming language.

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

afryan
Posts: 4
Joined: Wed Oct 24, 2012 7:30 pm

Creating a table with @pcy in a row

Postby afryan » Wed Dec 12, 2012 1:35 pm

I'm writing a program to create a table so that I can have a consistent view of certain values in a workfile. I've figured out how to show the level of series in this simple table using @elem to refer to each month's value, but I would also like to be able to show the percentage change from the prior year. I run into difficulty with the line "mytab(!row,!col) = @elem(@pcy(y), %k)", because "@PCY is an illegal or reserved name".

I recognize that one work around is to create a series that is the percentage change from the prior year, and then insert that in the table, and then delete it. But I was curious if there was less complicated solution.

By the way, are there any examples of programs that create simple tables, I'm sure I have much to learn?

I'm using Eviews 7.2. A sample of the program follows.

Code: Select all

workfile work m 1987.1 2012.12 series y = @trend table mytab !row=1 !col=2 %yr = @str(2012) for !x=1 to 12 %k = %yr + "m" + @str({!x}) mytab(!row,!col) = %k !col = !col +1 next !row = !row + 1 mytab(!row,1) = "y" !col=2 for !x=1 to 12 %k = %yr + "m" + @str({!x}) mytab(!row,!col) = @elem(y, %k) !col = !col +1 next !row = !row + 1 mytab(!row,1) = "@pcy(y)" !col=2 for !x=1 to 12 %k = %yr + "m" + @str({!x}) mytab(!row,!col) = @elem(@pcy(y), %k) !col = !col +1 next

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

Re: Creating a table with @pcy in a row

Postby EViews Gareth » Wed Dec 12, 2012 1:56 pm

The way you describe is, probably, the best way to do it.

You might also try just using the freeze command to freeze the spreadsheet view of the series (or, if you want a group containing the series and the @pch of the series), and then using the table.copyrange command to copy the whole lot in one go.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests