Thanks, I think that this would work. The variables appear to be correctly identified... but for some reason when I run it, it is only giving me 83 results. I expect there to be more than 454 (since that is how many report eating ice cream... I am not sure what I am doing wrong. CLass_1_p is an indicator for those who reported eating ice cream. Date is the time they were asked (some were asked multiple times to report). data try6; set limit(keep=ID Class_I_p RESULT_DATE comments); i=0; j=0; ixp=0; ixs=-2; do while (findw(comments,"ICE",' ,','e',ixs+3)); i+1; if i eq 1 then ixs+3; ixp=findw(comments,"ICE",' ,','e',ixs)+ixp; if Class_I_p=1 then do; j+1; SCOOPS=catx(' ',scan(comments,ixp-4,' '),scan(comments,ixp-3,' ')); Flavor = scan(comments,ixp-1,' '); output; end; ixs=findw(comments,"ice",ixs)+3; end; run; NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 1617:44 NOTE: There were 7699 observations read from the data set WORK.LIMIT. NOTE: The data set WORK.TRY6 has 83 observations and 13 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
... View more