Good afternoon All. I have a table with a singular column which contains a variety of character strings delimited by a colon. Example: Data NewData; length ReasonCode $255.; Input REASONCODE $; datalines; aaa:bbb:ccc:ddd:eee eee:aaa:fff:mmm ddd:rrr:yyy:zzz xxx:ggg ; run; No what I want to do is split out the string by the delimiter which I believe I had as per below. This creates Var1, 2, 3 etc from the string and those are populated with aaa, bbb, ccc etc data NextStep ; set NewData; array var(40) $45.; i=1; do until (scan(ReasonCode,i,":") eq ""); var(i)=scan(ReasonCode,i,":"); i+1; end; run; Thus creating the following dataset: REASONCODE var1 var2 var3 var4 var5 aaa:bbb:ccc:ddd:eee aaa bbb ccc ddd eee eee:aaa:fff:mmm eee aaa fff mmm ddd:rrr:yyy:zzz ddd rrr yyy zzz xxx:ggg xxx ggg Now where I'm getting stuck on logic/coding is that I want to take every iteration of new variable such as aaa, bbb, ccc and make it a Column Heading and count the number of times this appears in the data? REASONCODE aaa bbb ccc ddd eee ggg fff mmm rrr xxx yyy zzz aaa:bbb:ccc:ddd:eee 1 1 1 1 1 0 0 0 0 0 0 0 eee:aaa:fff:mmm 1 0 0 0 1 0 1 1 0 0 0 0 ddd:rrr:yyy:zzz 0 0 0 1 0 0 0 0 1 0 1 1 xxx:ggg 0 0 0 0 0 1 0 0 0 1 0 0 Appreciate any help that you can provide.
... View more