Hi Matt,
Thanks a lot!!!
By the way, i can't find the place to post my own question, could you show me?
Best,
@recode
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Re: @recode
Best,
SK
SK
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: @recode
When you're on the topic list page for a board, just press the "New Topic" button. This button is located near both the top (shown below) and bottom of the page.
Re: @recode
Hi Matt,
I have another problem for merging data, it's a little bit like the question i asked before, and below is the suggestion that you gave me.
but now, I have 2 requirements, i need to comparison the 'ds_s_f' and 'syear'
for example,
if ds_s_f=357299, syear=2005 exist in file AG, then AG_s= the value in file AG
here is the code that i tried to run, but i do not know how to get the specific cell(e.g. 357299,2005)in AG
I have another problem for merging data, it's a little bit like the question i asked before, and below is the suggestion that you gave me.
but now, I have 2 requirements, i need to comparison the 'ds_s_f' and 'syear'
for example,
if ds_s_f=357299, syear=2005 exist in file AG, then AG_s= the value in file AG
here is the code that i tried to run, but i do not know how to get the specific cell(e.g. 357299,2005)in AG
Code: Select all
group o ser*
stomna(o, om)
rowvector ds = @rowextract(om)
scalar nfirm = @columns(om)
vector dsv = @transpose(ds)
scalar nS = @rows(ds_s_f)
'scalar nC = @rows(ds_c_f)
series AG_s
for !i = 1 to nS
for !j = 1 to nfirm
if ds_s_f(!i) = dsv(!j) then
!y =syear(!i)-1969
AG_s(!i) = om(!j,!y)
endif
next
next
EViews Matt wrote:Ah, you want to test if each value in scomp_cusp_al matches ANY value in cusip_alpha, and copy the corresponding type value. @recode is not the way to do this. Basically, you need to manually go through every observation in scomp_cusp_al and search for a matching observation in cusip_alpha.Code: Select all
series DS_s
for !i = 1 to @obsrange
if scomp_cusp_al(!i) <> "" then
for !j = 1 to cusip_alpha.@last
if scomp_cusp_al(!i) = cusip_alpha(!j) then
DS_s(!i) = type(!j)
!j = @obsrange
endif
next
endif
next
- Attachments
-
- 00.JPG (396.47 KiB) Viewed 8359 times
-
- CUSIP_FF_run.csv
- (56.26 KiB) Downloaded 758 times
-
- AG.CSV
- (107.55 KiB) Downloaded 769 times
Best,
SK
SK
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: @recode
I believe part of the issue is that you're attempting to access objects in two different workfiles. It'll be easier to write your program if all the data is in single workfile. My advise would be to copy the AG workfile page to the CUSIP_FF_run workfile (as a new page, and renaming it to AG). You can then do the following at the beginning of your program,
Code: Select all
' Switch to the AG page
pageselect ag
' Build your group and matrix for the AG data
group o ser*
stomna(o, om)
' Switch back to the CUSIP_FF_run page
pageselect cusip_ff_run
' Move the om matrix from the AG page to the CUSIP_FF_run page.
copy ag\om om
delete ag\om
Re: @recode
Hi Matt,
Actually, I only have a cusip_FF_run workfile, and import the AG in the same workfile(please check the attachment)
Where i stuck is that i try to find whether the ds_s_f is in the group om R1, if exist, and find the date(correspond 'syear'), then got the value or NA(as following picture)
But there may have something wrong in my loop, there always show errors(i don't know why '!y' showed that value, '!y' should be the order from header to bottom, e.g. 2005-1969 = 36, pick the no.36 value of the column)...please help to find where i need to modified, or there maybe have another much easier and faster way to solve the problem. Thanks a lot!!!!!!!!!!!!!!!!!
Actually, I only have a cusip_FF_run workfile, and import the AG in the same workfile(please check the attachment)
Where i stuck is that i try to find whether the ds_s_f is in the group om R1, if exist, and find the date(correspond 'syear'), then got the value or NA(as following picture)
But there may have something wrong in my loop, there always show errors(i don't know why '!y' showed that value, '!y' should be the order from header to bottom, e.g. 2005-1969 = 36, pick the no.36 value of the column)...please help to find where i need to modified, or there maybe have another much easier and faster way to solve the problem. Thanks a lot!!!!!!!!!!!!!!!!!
- Attachments
-
- error
- 11.JPG (199.63 KiB) Viewed 8338 times
-
- cusip_ff_run.wf1
- (13.44 MiB) Downloaded 278 times
-
- example
- 00.JPG (372.74 KiB) Viewed 8338 times
Last edited by shineK on Tue Jul 03, 2018 4:09 am, edited 1 time in total.
Best,
SK
SK
Re: @recode
By the way,
i need to calculate the yearly return by monthly return, and the period defined as July,t-1 to Jun t, how do i get this kind of period to calculate the annual return???
And, there r another two kinds of control variable(the concept similar as previous), the definition as below
1. buy-and-hold return over Jan(t) to June(t) where t is the portfolio formation year t >> BHRET6_it=[(1+r)_(i,1))*…*(1+r_(i,6) )]-1
2. the 36 months buy-and-hole return over July(t-3) to June(t)
(this two are my major issue, if go through, after may much easier, really need your help, and really really thank you for helping me)
i need to calculate the yearly return by monthly return, and the period defined as July,t-1 to Jun t, how do i get this kind of period to calculate the annual return???
And, there r another two kinds of control variable(the concept similar as previous), the definition as below
1. buy-and-hold return over Jan(t) to June(t) where t is the portfolio formation year t >> BHRET6_it=[(1+r)_(i,1))*…*(1+r_(i,6) )]-1
2. the 36 months buy-and-hole return over July(t-3) to June(t)
(this two are my major issue, if go through, after may much easier, really need your help, and really really thank you for helping me)
- Attachments
-
- RETM_F.xlsx
- (1001.01 KiB) Downloaded 754 times
Last edited by shineK on Tue Jul 03, 2018 5:41 am, edited 1 time in total.
Best,
SK
SK
Who is online
Users browsing this forum: No registered users and 73 guests