Dear Forum Members
I have a column of repetitive dates in my workfile and I like to assign unique values to each date even though they repeat a couple of times. The format is the following way 19910702 where each data corresponds to daily stock returns. For example, this single observation (19910702) repeats 20 times, but I want it to have a unique ID for all the repetitions. I tried Proc>Structure/Resize Current Page>Undated with ID Series but it kept saying that I have non-unique observations. I would very much appreciate if you could help with this issue.
Thanks
Identifier for repetitive series
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Identifier for repetitive series
How do you want to handle the multiple values? Sum them? Keep the first? Etc....
Re: Identifier for repetitive series
Thanks for the quick response. Here is what I would like to do:How do you want to handle the multiple values? Sum them? Keep the first? Etc....
stockids datadate returns date_id(I am trying to get this one)
17891 19910702 0.024691358 1
19449 19910702 0.021568627 1
19565 19910702 0.010830325 1
13470 19910703 0.111111111 2
13636 19910703 -0.005076142 2
17891 19910703 0.006024096 2
13470 19910704 0.122222222 3
13636 19910704 -0.005102041 3
17891 19910704 0.017964072 3
I wanted to create an identifier for datadate such that all 19910702 is 1, 19910703 is 2, and 19910702 is 3. And then for each day (each id), I wanted to calculate the average stock returns. Basically, I have a portfolio of a bunch of stocks and I am trying to calculate the daily return of the portfolio.
As mentioned before, for each date_id number, I would like to calculate the average stock returns. Do you mind providing me some guidance on this issue as well?
I tried the following but it did not work:
scalar n=3 'Number of days over which portfolio returns are calculated
vector(n) daily_return
for !j=1 to 3
date_id=!j
daily_return(!j)=@mean(streturns)
next
next
Thanks
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Identifier for repetitive series
You might try a slightly different approach. You already have a unique identifier for each day, it just isn't 1, 2, 3, etc. Set up a new page using the unique values of datadate. Then copy your data from the current page into that new page matching by datadate and using the mean value .
Re: Identifier for repetitive series
I finally used another software to generate the identifiers (I still don't know how to create them with eviews). as mentioned above my next goal is to calculate the mean over these identifiers. I tried creating new page but it did not work. I need to repeat this process 2400 times. I would be very thankful if you can recommend any code for that.
Thank you so much
Thank you so much
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3798
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Identifier for repetitive series
You might want to check the @meansby function
Who is online
Users browsing this forum: No registered users and 2 guests
