How to create subsamples by date in batch?

For questions regarding programming in the EViews programming language.

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

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

How to create subsamples by date in batch?

Postby nsea411 » Fri Jan 22, 2021 7:55 am

Dear friends,

Now I have a time series contains daily stock price data from 2000/1/1 to 2020/12/31, what I want is to create 240 monthly subsamples(for example, use the daily data of 2000m01 to create the first monthly subsample, use the daily data of 2000m02 to create the second monthly subsample and so on).
I know the command of creating subsamples is "smpl" but I don't know how to create these subsamples in batch because I'm very new to Eviews programming, if anyone can help me, I will be greatly grateful(I'm using E10).

Thank you in advance!

(P.S. Because of the time difference, I may not reply immediately, please forgive me.)

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

Re: How to create subsamples by date in batch?

Postby EViews Gareth » Fri Jan 22, 2021 9:12 am

Code: Select all

for !i=1 to 240
     smpl 2000m1+!i-1 2000m1+!i-1
next
Follow us on Twitter @IHSEViews

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

Re: How to create subsamples by date in batch?

Postby nsea411 » Fri Jan 22, 2021 2:50 pm

Thank you, sir. You've really helped me a lot and I'll try.

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

Re: How to create subsamples by date in batch?

Postby nsea411 » Fri Jan 22, 2021 8:59 pm

EViews Gareth wrote:

Code: Select all

for !i=1 to 240
     smpl 2000m1+!i-1 2000m1+!i-1
next


Sorry to disturb you again, I also want to know how to generate a corresponding series after generating subsamples? For example, after generating 240 stock price subsamples, 240 new stock price series are also generated. Thank you again for your help!

EViews Matt
EViews Developer
Posts: 562
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to create subsamples by date in batch?

Postby EViews Matt » Mon Jan 25, 2021 2:31 pm

Hello,

You can include a series statement in the for loop to create the series, but the details will depend on how you want to name and optionally initialize the series (???).

Code: Select all

for !i=1 to 240
     smpl 2000m1+!i-1 2000m1+!i-1
     series ??? = ???
next

nsea411
Posts: 9
Joined: Wed Jan 20, 2021 9:02 am

Re: How to create subsamples by date in batch?

Postby nsea411 » Mon Jan 25, 2021 7:35 pm

EViews Matt wrote:Hello,

You can include a series statement in the for loop to create the series, but the details will depend on how you want to name and optionally initialize the series (???).

Code: Select all

for !i=1 to 240
     smpl 2000m1+!i-1 2000m1+!i-1
     series ??? = ???
next


Thank for your answer very much, Matt. I have created corresponding series in another way, which you might have seen in my another post(doing it my way creates new problems, and you've helped me again).


Return to “Programming”

Who is online

Users browsing this forum: Baidu [Spider] and 13 guests