Hi there, I have a SAS dataset called sasdata1 which has 40 variables with 20 of them named "attrib1" to "attrib20". There is also a variable called numattrib that stores the number of non-empty attributes starting from attrib1 (Obviously the value of numattrib could be different for different records). I want to create a sub-dataset called sasdata2 with records meeting the condition that any of attrib1-attrib20 starts with either "123" or "13a" or "2a1". Here is my SAS code: DATA sasdata2; SET sasdata1; if Substr(attrib1,1,3) in ('123','13a','2a1') or Substr(attrib2,1,3) in ('123','13a','2a1') or .... Substr(attrib20,1,3) in ('123','13a','2a1') or ; RUN; My first question is whether it is possible to consolidate these 20 lines of code after the key word if. Second question is whether we can take advantage of the variable numattrib to design a more efficient import process. Thank you very much in advance.
... View more