Page 1 of 1

how to limit sample to a qualitative characteristics

Posted: Fri Jul 24, 2015 7:25 pm
by financialwar
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.

Re: how to limit sample to a qualitative characteristics

Posted: Fri Jul 24, 2015 9:41 pm
by EViews Gareth

Code: Select all

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

Re: how to limit sample to a qualitative characteristics

Posted: Sat Jul 25, 2015 6:34 am
by financialwar
Thank you.

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

Re: how to limit sample to a qualitative characteristics

Posted: Sun Jul 26, 2015 6:35 am
by Thomasms90
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).