Hello,
Thanks in advance for suggestions. I want to change the format of the data (I think the correct terminology is to go from wide format to long format).
I have a dataset that looks like this:
countrycode year discrimination_Christianity discrimination_Judaism discrimination_Islam
1 2000 0 0 1
1 2001 0 1 1
2 2000 1 1 0
2 2001 1 1 0
I would like to transform it into country-year-religiousgroup format so that instead of three separate columns for different discrimination by different religious groups,
I can replace with one column called discrimination. And then I would add religious groups as rows for each country-year like the following:
countrycode year religiousgroup discrimination
1 2000 Christianity 0
1 2000 Judaism 0
1 2000 Islam 1
1 2001 Christianity 0
1 2001 Judaism 1
1 2001 Islam 1
2 2000 Christianity 1
2 2000 Judaism 1
2 2000 Islam 0
2 2001 Christianity 1
2 2001 Judaism 1
2 2001 Islam 0
I think I might need to use the reshape command but I have never done it before and I wonder if that is the best one?
This is the code I have so far:
reshape long discrimination, i(countrycode) j(year) k(religiousgroup)
will this work?
Thank you,
Daniel