Hi Allin,
Thanks a million! It Works perfectly! How should I do to post a gratitude
message on the gretl-users forum so that everybody knows that you provided
the right answer? I mean, to go beyond a personal/private email message.
Regards,
Cruz
-----Mensaje original-----
De: Allin Cottrell [mailto:cottrell@wfu.edu]
Enviado el: jueves, 23 de mayo de 2019 19:57
Para: Gretl list
Asunto: [Gretl-users] Re: Dummy
On Thu, 23 May 2019, cruz.echevarria(a)ehu.eus wrote:
Dear Gretl users,
I am aware that the following might be trivial, but I am stuck.
Suppose that you have a panel data set whose units are countries
identified by a numerical variable, say "ccode". And you want to
split the sample into two sub-samples: OECD and non-OECD members.
I have tried the following:
genr OECD = 0
if ccode == 1
replace OECD = 1
elif ccode == 4
replace OECD = 1
(...)
end
It does not work. I am aware of the piece of warning in the
Hansl's manual for Stata users (page 32). But, does anyone know
hos I should do this?
If I'm understanding the objective correctly, this is easier than
you're making it!
series OECD = ccode == 1 || ccode == 4
To the right of the first '=' we have a Boolean expression which
evaluates to 1 if the condition (in natural language, "ccode equals
1 or ccode equals 4") is true, 0 otherwise.
The alternation of "ccode == x" values can be continued, split over
more than one line using backslash if necessary.
Allin
_______________________________________________
Gretl-users mailing list -- gretl-users(a)gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave(a)gretlml.univpm.it
Website:
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/