I have a table as follows:
ID Code
A01 111
A02 112
A03 112
A04 113
A05 114
A06 114
All the code are in the range between 111 and 180 with different frequencies of occurrence.
I want to create columns that contain indicators of these codes. The table I want after adding these indicators is as follows:
ID Code Code_111 Code_112 Code_113 Code_114
A01 111 1 0 0 0
A02 112 0 1 0 0
A03 112 0 1 0 0
A04 113 0 0 1 0
A05 114 0 0 0 1
A06 114 0 0 0 1
Since there're 70 code numbers, it's simply too hard to do this manually. Is there a way that I can do this quickly in SAS or Teradata like a macro? Thanks a lot for your help in advance.
Start Free Trial