I want to pick the number of observation in the sample, that is shown in the second line in each workfile (not the number of observation of a series because this varies)
the code looks like this:
sample crisis 2008 @last ' definition of my specific sample
smpl crisis ' select this sample
scalar time= @dateval("1/1/2008")@dateval("5/15/2009") ' calculate the number of observation between the first and the last date
However, I don't want to type for each specific sample the start and end date, is there a nice solution?
I tried
scalar time= @dateval(@last)@dateval(@first)
but it doesn't work!
By the way, the code above gives me 730088 but I want 358.
sample size
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12462
 Joined: Tue Sep 16, 2008 5:38 pm
Re: sample size
@obsrange  returns number of observations in workfile range.
@obssmpl  returns number of observations in current sample.
@obssmpl  returns number of observations in current sample.
Follow us on Twitter @IHSEViews

 Posts: 3
 Joined: Sun Jul 07, 2013 8:54 am
Re: sample size
I'd like to change my sample size for one transformation, however, if I use for example:
smpl @first+1 1998:1
mtos(matrix, group)
smpl @all
I need to do this because 'matrix' is smaller then my complete sample. All values beyond 1988:1 are gone from the matrix afterwards. Is there a way to change the sample size without loosing data?
edit: correction: Eviews does not delete the data, it somehow squishes it together... In any case, my code doesn't work
smpl @first+1 1998:1
mtos(matrix, group)
smpl @all
I need to do this because 'matrix' is smaller then my complete sample. All values beyond 1988:1 are gone from the matrix afterwards. Is there a way to change the sample size without loosing data?
edit: correction: Eviews does not delete the data, it somehow squishes it together... In any case, my code doesn't work

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

 Posts: 3
 Joined: Sun Jul 07, 2013 8:54 am
Re: sample size
sorry for the bad explanation. I'll try again:
my sample ranges from 1991q1 till 2013q4
I ran some rolling OLS etc the results of which are collected into a matrix with 28 rows. I want to display this matrix as time series, so the xaxis shows the start years of the rolling windows (otherwise its annoying to interpret). Thats why I want to create groups out of the matrices. However, Eviews doesn't do that if the matrices are smaller than the sample size.
So I tried the code above. It runs through but does strange things to my data.
my sample ranges from 1991q1 till 2013q4
I ran some rolling OLS etc the results of which are collected into a matrix with 28 rows. I want to display this matrix as time series, so the xaxis shows the start years of the rolling windows (otherwise its annoying to interpret). Thats why I want to create groups out of the matrices. However, Eviews doesn't do that if the matrices are smaller than the sample size.
So I tried the code above. It runs through but does strange things to my data.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12462
 Joined: Tue Sep 16, 2008 5:38 pm
Re: sample size
Sorry, still not following.
You have a matrix with 28 rows. You have set the sample to be 1991Q2 to 1998Q1. That's 28 observations. You then convert the matrix into a group. EViews will put those 28 rows into the 28 observations you have in the sample. Nothing will be squashed. Nothing will be lost.
You have a matrix with 28 rows. You have set the sample to be 1991Q2 to 1998Q1. That's 28 observations. You then convert the matrix into a group. EViews will put those 28 rows into the 28 observations you have in the sample. Nothing will be squashed. Nothing will be lost.
Follow us on Twitter @IHSEViews

 Posts: 3
 Joined: Sun Jul 07, 2013 8:54 am
Re: sample size
You are right. Everything looks good now. I don't know what the problem was... Feel free to delete the posts above if you want to keep this clean.
Thank you so much for your quick responses and sorry for wasting your time!
Thank you so much for your quick responses and sorry for wasting your time!
Who is online
Users browsing this forum: No registered users and 55 guests