how to limit sample to a qualitative characteristics

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

financialwar
Posts: 3
Joined: Fri Jul 24, 2015 7:11 pm

how to limit sample to a qualitative characteristics

Postby financialwar » Fri Jul 24, 2015 7:25 pm

I am currently reading "Forecasting, Method and Application 3rd", the data I have is about second hand cars and it contains four variables, the car model, the country it is made in (USA or Japan), mileage and price it was sold for.

Now, I want to limit the sample to Japanese cars only, the data contain the words USA or Japan, and not 1 or 2. Is there a way to limit the sample to Japanese cars without having to first change USA/Japan to 1 and 2 first? Because in the IF condition, when I type

Code: Select all

country = Japan
it gives me error.

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

Re: how to limit sample to a qualitative characteristics

Postby EViews Gareth » Fri Jul 24, 2015 9:41 pm

Code: Select all

country = "Japan"
Note it will be case sensitive.

financialwar
Posts: 3
Joined: Fri Jul 24, 2015 7:11 pm

Re: how to limit sample to a qualitative characteristics

Postby financialwar » Sat Jul 25, 2015 6:34 am

Thank you.

If I want to change "USA" to 1 and "Japan" to 2, how would I do that?

Thomasms90
Posts: 15
Joined: Wed Mar 20, 2013 7:14 am

Re: how to limit sample to a qualitative characteristics

Postby Thomasms90 » Sun Jul 26, 2015 6:35 am

Assuming your series "country" is an alpha series:

Code: Select all

series country_num = @iif(@eqna("USA", country)=1, 1, 2)
Would create new numeric series and assign 1 to "USA" and otherwise 2 based on an alphanumeric string. Note you can't assign values to an alphanumeric series (i.e. just overwrite the series).


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests