@first and @last equivalents for smpl?

For questions regarding programming in the EViews programming language.

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

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

@first and @last equivalents for smpl?

Postby bhaupt » Sun Sep 26, 2010 8:52 pm

Eviews 7.1:
In order to seasonallyadjust properly, my samples are almost all all subsets of my workfile. Is there a way to get the first element of a sample, since @first gives me the @first element of the workfile, not of the sample?

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

Re: @first and @last equivalents for smpl?

Postby EViews Gareth » Sun Sep 26, 2010 9:55 pm

What are you trying to achieve?

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: @first and @last equivalents for smpl?

Postby bhaupt » Mon Sep 27, 2010 7:46 am

short answer: Categorization for processing
I have a dataset of stores, some of which I am inserting imputed values, some of which I am resetting samples. Some of these will contain more than 36 months of data (and can therefore be seasonally adjusted and trended) and others will fall short, and will then use the seasonal factors from an aggregate and/or average store.

while @obs, @nas and similar functions cant take a sample argument, I either have to know specifically the sample necessary for each store before resetting the sample, or it becomes an extremely nasty set of code to work off the bounds.

I use a recursive function which recalculates the sample based on the number of @nas left in the changing sample. I'm solving most of this currently by taking and building two table objects and effectively recalculating the offset based on the current sample. It is a kluge but it seems like my only option. Having better access to the startpoint and endpoint of a sample would eliminate the need for a lookup table which I am constantly updating.

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

Re: @first and @last equivalents for smpl?

Postby EViews Gareth » Mon Sep 27, 2010 8:12 am

Both @obs and @nas work off the current workfile sample, so you just change the workfile sample, then use them.

I'm afraid it still wasn't particularly clear to me what you were doing, so I'm not sure how I can offer more help than that. Could you provide more detail on what you want @first, @last for?

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: @first and @last equivalents for smpl?

Postby bhaupt » Mon Sep 27, 2010 10:27 am

@obs and @nas provide results relative to the workfile, not relative to the sample.

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: @first and @last equivalents for smpl?

Postby startz » Mon Sep 27, 2010 10:41 am

All series in a workfile page have the same range. There is no series-specific sample.

Is your situation that you have a bunch of NAs at different places in some series than in others?

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: @first and @last equivalents for smpl?

Postby javiersan » Mon Sep 27, 2010 10:46 am

If you want the date range of your samples you can always do something like this (in EV7.1 at least) for storing your sample starting and end points in string format
%smplrange=@pagesmpl
%smpl_first=@wleft(%smplrange,1)
%smpl_last=@wright(%smplrange,1)

I am not sure either whether this answers your question.

Regards,

Javier

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

Re: @first and @last equivalents for smpl?

Postby EViews Gareth » Mon Sep 27, 2010 10:59 am

javiersan's solution only works for simple samples. Any samples with if conditions won't work.

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: @first and @last equivalents for smpl?

Postby bhaupt » Tue Sep 28, 2010 5:11 am

In this case the simple solution will work as a subroutine. If I do find I need to handle conditional sampless I can use this as a foundation.

Thank you all for your replies.

(And yes, Starz -I am in the process of constructing 100+ system models each of which have different data holes. Each unique model is used to categorize the behavior, regional models are built, classification models are built, and then a complete model is then built. From this, each system is then rescored vs expected behavior.)

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: @first and @last equivalents for smpl?

Postby startz » Tue Sep 28, 2010 7:02 am

Sounds like you have a solution that works. Just in case, remember that the observation pointed to by @first can very well be NA. (Of course, you may have already set the sample to avoid this.)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests