Table: Putting texts in cell using loop

For questions regarding programming in the EViews programming language.

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

banhbengconuong
Posts: 15
Joined: Mon Apr 25, 2011 8:31 pm

Table: Putting texts in cell using loop

Postby banhbengconuong » Tue Mar 11, 2014 4:50 am

I am creating the table with the rows are different criteria and columns are different variables. May I use a loop for putting the text in headers of each row and column?
For example, I tried the following but it fails for the headers of rows.

table(5,2) mytab
tab3(1,1) = "Variables/Crit"
tab3(1,2) = "Age"
tab3(1,3) = "Gender"

!row = 1
for %x Mean Median Max Min Std
!row = !row + 1
tab3(!row,1) = "{%x}"
next

Does anyone know how to do it? Because the criteria are about 20 ones. Thanks a bunch for your help!

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

Re: Table: Putting texts in cell using loop

Postby EViews Gareth » Tue Mar 11, 2014 3:53 pm

Code: Select all

!row = 1
for %x Mean Median Max Min Std
!row = !row + 1
tab3(!row,1) = %x
next
Follow us on Twitter @IHSEViews

banhbengconuong
Posts: 15
Joined: Mon Apr 25, 2011 8:31 pm

Re: Table: Putting texts in cell using loop

Postby banhbengconuong » Tue Mar 11, 2014 6:25 pm

thank you a lots, it works perfectly.

EViews Gareth wrote:

Code: Select all

!row = 1
for %x Mean Median Max Min Std
!row = !row + 1
tab3(!row,1) = %x
next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 50 guests