restrict sample

For questions regarding programming in the EViews programming language.

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

JamyOliver
Posts: 9
Joined: Thu Jan 31, 2013 6:00 am

restrict sample

Postby JamyOliver » Wed Apr 17, 2013 1:50 pm

Hi guys!

My problem is probably really simple to solve but i couldn't find a solution in the Evies User guide.
My workfile consists of a pannel with many different variables. One of the is a "sponsor_dummy" which consists of different numbers, depending on the sponor. (E.g. 1 = FedEx, 2 = Pepsi etc.). The numbers are between 1-20. I want to restructure my sample size, that I can analyze different sponsors more specifically.

E.g.:
sample 100 120 if sponsor_dummy = 1, 2, 3, 4, 5, 10, 14
Therefore the sample should consist of observations between 100 and 120 and should only include sponsors nr. 1, 2, 3, 4, 5, 10 and 14.
I tried it with an "OR" operator but it doesn't work. Is there any solution for this problem?

JamyOliver
Posts: 9
Joined: Thu Jan 31, 2013 6:00 am

Re: restrict sample

Postby JamyOliver » Wed Apr 17, 2013 3:00 pm

ok sorry guys, I just got the solution for my problem its simply:

smpl @all if sponsor_dummy_ = 1 or sponsor_dummy_ = 2

Was really quite simple and probably a syntax error in my first try. But no I have another problem because I want to combine my season and sponsor dummy.
I am working on data about nfl games and want to restrict my sample to certain sponsors in different seasons. Therefore I tried it like this:

smpl @all if season_dummy_ = 1 and sponsor_dummy_ = 1 or sponsor_dummy_ = 2 or sponsor_dummy_ = 3

I want to restrict the sample only to season 1 and that only sponsor nr. 1, 2 and 3 out of 20 are included. But the number of observations that I get with this command is definitely wrong.Does anybody see my mistake, or even better, does anyone has a solution how it could work?!

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

Re: restrict sample

Postby EViews Gareth » Wed Apr 17, 2013 3:19 pm

You probably need parenthesis. There is a difference between:

Code: Select all

if season_dummy=1 AND (sponsor_dummy=1 OR sponsor_dummy=2 OR sponsor_dummy=3)
and

Code: Select all

if season_dummy=1 AND sponsor_dummy=1 OR sponsor_dummy=2 OR sponsor_dummy=3

JamyOliver
Posts: 9
Joined: Thu Jan 31, 2013 6:00 am

Re: restrict sample

Postby JamyOliver » Wed Apr 17, 2013 11:45 pm

thx for your support! That solved my problem!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest