Dummy variables: Creating by mapping to an Alpha series.
Posted: Wed Jan 27, 2010 10:41 pm
Hi,
I am using EViews 7.
In an undated workfile with range = 15 I have an alpha series named Country:
Country = {AUT, AUT, AUT, BLX, BLX, BLX, BLX, BGR, BGR, CYP, CYP, CYP, CYP, CYP, CZE}.
Is there an easy way for me to create the following five dummies?
d_AUT = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
d_ BLX = {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
d_BGR = {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0}
d_CYP = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}
d_CZE = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
The commands below don't work but I hope it shows what I'm trying to do:
for %ctr AUT BLX BGR CYP CZE
series d_{%ctr} = stick a one in the same element when @elem(Country) = {%ctr}
next
or
for %ctr AUT BLX BGR CYP CZE
series d_{%ctr} = @recode(Country = {%ctr},"1","0")
next
Thanks in advance for any suggestions.
Vlad.
I am using EViews 7.
In an undated workfile with range = 15 I have an alpha series named Country:
Country = {AUT, AUT, AUT, BLX, BLX, BLX, BLX, BGR, BGR, CYP, CYP, CYP, CYP, CYP, CZE}.
Is there an easy way for me to create the following five dummies?
d_AUT = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
d_ BLX = {0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
d_BGR = {0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0}
d_CYP = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}
d_CZE = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
The commands below don't work but I hope it shows what I'm trying to do:
for %ctr AUT BLX BGR CYP CZE
series d_{%ctr} = stick a one in the same element when @elem(Country) = {%ctr}
next
or
for %ctr AUT BLX BGR CYP CZE
series d_{%ctr} = @recode(Country = {%ctr},"1","0")
next
Thanks in advance for any suggestions.
Vlad.