Hi,
I'm using EViews 9.
A very simple one that I can't figure out...
I'm working with monthly data. In my program, I need to calculate the number of months between two dates
for instance, if I've got this code :
smpl %end_est %end_forecast
What formula would give me the number of months in that current sample ?
Thanks!
Danny
How to calculate the number of month between two dates
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to calculate the number of month between two dates
Depends. Are you asking how many observations are there between the end and start of the current sample? If so @obssmpl.
If you want to know how many months there are between two dates, you can use @datediff.
If you want to know how many months there are between two dates, you can use @datediff.
Follow us on Twitter @IHSEViews
Re: How to calculate the number of month between two dates
Hi,
@obssmpl works fine as long as there are no missing values in the sample period.
Given two dates (ex. smpl 2008m12 and 2012m06), is there another way to determine the number of months covered by that sample period?
Thanks!
Danny
@obssmpl works fine as long as there are no missing values in the sample period.
Given two dates (ex. smpl 2008m12 and 2012m06), is there another way to determine the number of months covered by that sample period?
Thanks!
Danny
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to calculate the number of month between two dates
Not sure what you are askibg
Follow us on Twitter @IHSEViews
Re: How to calculate the number of month between two dates
Hi,
I want to run a program that ask the user to provide a sample period of two dates (ex. 2008m12 and 2012m06) and I need a command or formula that will determine the number of months between these two dates. That number will be used later in the program in a For loop.
Is there a way other than using the @obssmpl?
Thanks!
Danny
I want to run a program that ask the user to provide a sample period of two dates (ex. 2008m12 and 2012m06) and I need a command or formula that will determine the number of months between these two dates. That number will be used later in the program in a For loop.
Is there a way other than using the @obssmpl?
Thanks!
Danny
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to calculate the number of month between two dates
EViews Gareth wrote:Depends. Are you asking how many observations are there between the end and start of the current sample? If so @obssmpl.
If you want to know how many months there are between two dates, you can use @datediff.
Follow us on Twitter @IHSEViews
Re: How to calculate the number of month between two dates
Hi Gareth,
@datediff works perfectly.
Thanks a lot!
Danny
@datediff works perfectly.
Thanks a lot!
Danny
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: How to calculate the number of month between two dates
That's why I mentioned it the first time
Who is online
Users browsing this forum: Google [Bot] and 23 guests