Hello everyone, I’m new to SAS and have been trying to figure out how to solve the following problem: Let’s assume I have the following dataset: data specialty; input ID specialty $12. ; cards; 1 Neurologist 1 Psychologist 2 GP 3 Neurologist 4 Cardiologist 5 Cardiologist ; run; What I want to do now is to create a new column for every physician specialty from the column “specialty” and put a “1” in the respective column if it fits and zero otherwise. So the result should look like this: ID specialty Neurologist Psychologist GP Cardiologist 1 Neurologist 1 0 0 0 1 Psychologist 0 1 0 0 2 GP 0 0 1 0 3 Neurologist 1 0 0 0 4 Cardiologist 0 0 0 1 5 Cardiologist 0 0 0 1 I solved the problem with creating every variable manually and lots of “if then statements” for now but I’m not very happy with this. Is there a more elaborated way to achieve the desired outcome? Thank you!
... View more