I am working with factory-year panel data wherein information about many variables (for e.g. wages, employment, rural/urban, etc.) is gathered for different factories in the country for every year. In this data set, there is a variable 'x' which has 9 categories (1,2,...,9). It looks something like this:
Year Factory ID X Category S.No.
2009 118F 10 1
2009 118F 16 2
2009 118F 31 3
2009 118F 90 4
2009 118F 54 5
2009 118F 17 6
2009 118F 62 7
2009 118F 57 8
2009 118F 51 9
2009 202F 83 1
2009 202F 39 2
2009 202F 44 3
2009 202F 54 4
2009 202F 12 5
For the purpose of my analysis, however, I require the 9 categories to be separate variables in the following format:
Year Factory ID X1 X2 X3 X4 X5 X6 X7 X8 X9 .
2009 118F 10 16 31 90 54 17 62 57 51 .
2009 202F 83 39 44 54 12 20 20 20 20 .
How do I get to this? I would be extremely grateful for any guidance in this matter.