1/ with @wlookup @pagelist that i can rename all coefs series like this: d_{name of equation}_{name of page} (for @wlookup if i don't know what their names of equations), and the function @pageselect to switch between pages.
2/ equation eq02 have 4 coefs (@quarter=1 to @quarter=4).
Extract coefs form different objects, double seasonal
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13305
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
1)
2)
If Equation 2 only has 4 coefficients, why is this code referencing coefficient 4+!i where !i runs from 1 to 53?
Code: Select all
%mypages = @pagelist
for %page {%mypages}
pageselect {%page}
rename myseries d_{name of equation}_{%page}
next
2)
If Equation 2 only has 4 coefficients, why is this code referencing coefficient 4+!i where !i runs from 1 to 53?
Code: Select all
for !i=1 to 53
smpl if @datepart(@date,"ww")=!i
series d_{%eq} = {%eq}.@coef(4+!i)
next
smpl @all
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
I have add 6 lines in the first of the code to rename the untitled pages to page_0!r, but it rename just the first page.
I get error message for my full program: 16 is not a valid index for vector-series-coefficient in "SERIES D_{%EQ} = EQ04.@COEF(4+12)".
I get error message for my full program: 16 is not a valid index for vector-series-coefficient in "SERIES D_{%EQ} = EQ04.@COEF(4+12)".
- Attachments
-
- data+prg.zip
- (7.78 KiB) Downloaded 243 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13305
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
I don't think you have a grasp on what for loops do/are for. I all we can do is suggest you read up on for loops (in any programming language), and start experimenting / practicing until you get the hang of them.
Always try to picture in your mind exactly what the for loop is doing at each stage.
Always try to picture in your mind exactly what the for loop is doing at each stage.
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
There are always keywords in your answers, it's pleasure to read them .
first, i agree that i have not use a methodology "loop for" in my code. i have problem to rename my pages Untitled page01 Untitled1 page02 Untitled2 page03.......( i can use this code it works, but i prefer to use @pagecount in the future if i need to rename multi pages)
second, i dont't now why i cannot extract all coefs, from my equations objects, manually it works.
could you look, if you can correct some mistakes.
first, i agree that i have not use a methodology "loop for" in my code. i have problem to rename my pages Untitled page01 Untitled1 page02 Untitled2 page03.......( i can use this code it works, but i prefer to use @pagecount in the future if i need to rename multi pages)
Code: Select all
for %1 %2 Untitled page01 Untitled1 page02 Untitled2 page03............etc
pagerename {%1} {%2}
next
second, i dont't now why i cannot extract all coefs, from my equations objects, manually it works.
could you look, if you can correct some mistakes.
- Attachments
-
- prg_gdp_test44.prg
- (2.67 KiB) Downloaded 237 times
Re: Extract coefs form different objects, double seasonal
1/I have use this code to rename all Untitled pages page_1, page_2,...: but i get error message.
2/I dont't now why i cannot extract all coefs, from my equations objects, manually it works. how can extract all the coefs?
Any help would be grateful.
Code: Select all
%mypages = @pagelist
for !r=1 to @pagecount
%page="page_"+@str(!r,"r02")
for %1 %2 {%mypages} {%page}
pagerename {%mypages} {%page}
next
next
2/I dont't now why i cannot extract all coefs, from my equations objects, manually it works. how can extract all the coefs?
Any help would be grateful.
Re: Extract coefs form different objects, double seasonal
How can rename my all pages untitled, by page_01 page_02....etc, and switch bitween pages and extract coefs from equations objects.
with my program and data.
with my program and data.
- Attachments
-
- prg_gdp_test44.prg
- (2.67 KiB) Downloaded 259 times
-
- gdp_test3.wf1
- (76.55 KiB) Downloaded 228 times
Re: Extract coefs form different objects, double seasonal
Hello,
Are there a solution for my loop for, could someone help me.
Are there a solution for my loop for, could someone help me.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13305
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Extract coefs form different objects, double seasonal
You need to figure this out for yourself.
Here's some code that will help you figure it out (or should!). Run it in a separate program on the same workfile.
Here's some code that will help you figure it out (or should!). Run it in a separate program on the same workfile.
Code: Select all
table a 'this is a table object created to show what's going on inside loops
a(1,1) = "Iteration" 'add some column titles to the table
a(1,2) = "%page"
a(1,3) = "!r"
!row=2 'this is a counter keeping track of which row of the table we're on
setmaxerrs 100 'set the maximum number of errors before halting to something big, so we can see what's going on.
' rename untitled pages THIS IS YOUR CODE WITH SOME DEBUGGING LINES ADDED
%mypages = @pagelist
for %page {%mypages}
for !r=1 to @pagecount
a(!row,1) = !row-1 'set the first colum of the table equal to the iteration number (which since !row starts at 2, is just !row-1
a(!row,2) = %page 'set the second column equal to whatever %page is at the moment
a(!row,3) = !r 'set the third column equal to whatever !r is
!row = !row+1 'increase our counter by 1
pagerename {%page} page_0!r
next
next
show a
Follow us on Twitter @IHSEViews
Re: Extract coefs form different objects, double seasonal
Thanks for this few lines, it was help me to understand the logic of loop for, now i can rename all pages with loop, but i get error message. i will look if i can solve this.... i hope
Who is online
Users browsing this forum: Google [Bot] and 30 guests