Hi, I need to sample every 30th observation from a series starting from the last observation, this is if my last observation is on the 7/15/2020, then the 30th observation before that would be the 6/15/2020, and then 5/15/2020. I was trying to use dateadd but didnt work. I hope someone knows the answer.
Thanks
sample every 30th observation from a series
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Posts: 27
- Joined: Mon Mar 30, 2020 5:45 pm
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: sample every 30th observation from a series
To be clear, you mean 7/15/2020, 6/15/2020 and 5/16/2020?
Oh, and what frequency is the workfile?
Oh, and what frequency is the workfile?
Follow us on Twitter @IHSEViews
-
- Posts: 27
- Joined: Mon Mar 30, 2020 5:45 pm
Re: sample every 30th observation from a series
my data is daily and have observations since 1989.
It doesnt matter if a month have 31 or 28 or 29, just need to substract 30 observations so yes 5/16/2020.
Thanks
It doesnt matter if a month have 31 or 28 or 29, just need to substract 30 observations so yes 5/16/2020.
Thanks
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: sample every 30th observation from a series
Code: Select all
smpl if @mod(@trend,30)=28
This assumes that you have daily 7 data that starts on Jan 1st 1989. If the starting date is different, you'll have to change the "28" value. Just do:
Code: Select all
show @mod(@trend,30)
and see what the value is on 2020/07/15 and use that value in the sample.
Follow us on Twitter @IHSEViews
-
- Posts: 27
- Joined: Mon Mar 30, 2020 5:45 pm
Re: sample every 30th observation from a series
Thank you Gareth, it works perfectly.
Regards
Regards
Who is online
Users browsing this forum: No registered users and 23 guests