I'm a fairly novice SAS programmer and after doing multiple searches I'm no wiser as to how to solve my current problem.
My dataset is fairly simple. I have two variables, namely caseid and condition. An example of the data is given:
caseid condition
1 headache
1 cough
1 vomiting
2 headache
2 cough
3 vomiting
4 rash
4 anaemia
I would like to split the "condition" variable into different variables based on the list of coniditons and so that each row within the data is listed by the caseid and a value of "1" is given when the caseid has the condition and a "0" when they don't. I would like my data to appears as:
caseid headache cough vomiting rash anaemia
1 1 1 1 0 0
2 1 1 0 0 0
3 0 0 1 0 0
4 0 0 0 1 1
I have tried transposing the data using caseid as the "by" variable which results in a dataset where the list of conditions still remains as the observation and not as a variable label. I've also tried creating an array to input the data into. All to no avail. I would appreciate any advice on how to resolve this issue.