Easy question

For questions regarding programming in the EViews programming language.

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

miigaa0213
Posts: 2
Joined: Sat Dec 21, 2024 3:52 am

Easy question

Postby miigaa0213 » Thu Dec 26, 2024 4:29 am

Hello, I wanted to restructure the current page and create a panel work-page with quarterly data from 2024Q4 to 2029Q4 and 10 observations each.
I have 5 variables "a g nx ra rl" and 10 series for each variable (i.e. a1,a2,...a10,g1,g2... etc). These series have recorded in work-page results and I want to create a new panel page with cross-id and date-id. However, When I try to save the data with the help of a loop on another page called a panel, it only saves the 10th observation of each variable for the whole series. Originally, the last series should have different values for each observation. Below is the syntax:


pagecreate(page=panel) q 2024Q4 2029Q4 10

' Initialize the new combined series
series a
series g
series nx
series ra
series rl

' Number of individual series to process
!num_series = 10 ' Replace with the actual number of series (e.g., 10 for a1, a2, ..., a10)

' Loop through each individual series and append data
for !i = 1 to !num_series
' Switch to the result page
pageselect result


' Create temporary series for the current iteration
smpl @all ' Ensure full sample is selected
copy a{!i} temp_a
copy g{!i} temp_g
copy nx{!i} temp_nx
copy ra{!i} temp_ra
copy rl{!i} temp_rl

' Switch to the Panel page
pageselect panel


' Append the data into the combined series
a = result\temp_a
g = result\temp_g
nx = result\temp_nx
ra = result\temp_ra
rl = result\temp_rl

next

' Display the restructured data
show a g nx ra rl

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

Re: Easy question

Postby EViews Gareth » Thu Dec 26, 2024 9:26 am

Hard to see what you're doing, but I think you should be using the pagestack command.
viewtopic.php?f=7&t=74
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests