Dear all,
I'm trying to solve something that seems rather easy but just doesn't work out. I hope one of you can help me out:
I'm using a dataset on cars in Belgium. Apart from sales, brands and car-characteristics, one column lists the "origin".
For the brand "alpharomeo" the variable org = "Italy", for the brand "peugot", org="France" and so on.
Now I want to create a variable for all cars of European origin.
I tried the command:
gen EU = (org == "Italy" "France" "Germany" "UK" "Sweden" "Spain" "EasternEurope")
[The names of the countries are in red, not sure whether this is supposed to be or not.]
but got the error: "type mismatch".
I then found a forum that dealt with a related question and tried:
gen newvar=""
(298 missing values generated)
replace newvar="EU" if org=="Italy" "France" "Germany" "UK" "Sweden" "Spain" "EasternEurope"
But got the error: "EU" not found
What am I doing wrong?
Kind regards,
Wouter
I'm trying to solve something that seems rather easy but just doesn't work out. I hope one of you can help me out:
I'm using a dataset on cars in Belgium. Apart from sales, brands and car-characteristics, one column lists the "origin".
For the brand "alpharomeo" the variable org = "Italy", for the brand "peugot", org="France" and so on.
Now I want to create a variable for all cars of European origin.
I tried the command:
gen EU = (org == "Italy" "France" "Germany" "UK" "Sweden" "Spain" "EasternEurope")
[The names of the countries are in red, not sure whether this is supposed to be or not.]
but got the error: "type mismatch".
I then found a forum that dealt with a related question and tried:
gen newvar=""
(298 missing values generated)
replace newvar="EU" if org=="Italy" "France" "Germany" "UK" "Sweden" "Spain" "EasternEurope"
But got the error: "EU" not found
What am I doing wrong?
Kind regards,
Wouter
Comment