data master; infile cards dsd; input id$ group$ prefix$ var1$ var2; cards; 100,abc,ABC,F,11 100,abc,123,F,11 200,abc,123,H,12 300,abc,123,F,11 400,qwe,123,H,13 500,qwe,ABC,F,15 ; run; data master; set master; if prefix = 'ABC' then value = 1; * need to insert appropriate program here that scans through rows vertically for each combination of id & group, and labels Value as 1 for row containing ABC and ignores other rows. Only one row should have a value of 1 if there are multiple mentions of ABC in prefix for each id-group combination. For example, for 1st two rows combination of id-group (100 & abc) mentioned above, only 1st row gets assigned Value as 1 and next row as missing. For the rest of rows not having prefix values of ABC the program is shown below. Hope this makes sense ; else if var1 = 'F' and var2 =11 then value = 2; else if var1 = 'H' and var2 =11 then value = 3; else if ......; else if ....; run;
... View more