I have a very similar dataset that I'm trying to adapt this code to and running into issues with the dummy responses not matching up. I have a file that I import where there is a store name (which I need to keep in the final data) and then a comma separated list of products (lets say there are 5 products for this example). Store1, Bread, Eggs, Juice Store2, Juice Store3, Eggs, Juice End result needs to be: Store Bread Eggs Juice Store1 1 1 1 Store2 0 0 1 Store3 0 1 1 I was able to get the code to run but once I looked at the dummy variables, they were not matching up. data response; input store :$20. v1 v2 v3 v4 v5; run; data indicator; set response; array items $ bread milk juice eggs cereal; do i = 1 to dim(items); items = not not find(response,vname(items),'IT'); end; drop i; run; proc print; run;
... View more