I have a set of data, the variable unit_number is supposed to contain only the numeric data, and unit_alphabet is supposed to contain only the one character data. However the original data may contain unit_number information in the unit_alpha variable to indicate that there are two unit_number information. If there is more than one unit_number information, there will be a comma followed by number in the unit_alphabet variable to separate the unit_number information. And I want each row of data only contain one unit number information, if the unit_number information is more than one (so there is a comma in the unit_alphabet variable followed by number), I want to add another row of data to indicate this. And it is possible there there are two character in the unit_alphabet variable, I want the first character to be assigned to the first unit_number, and the second character to be assigned to the second unit_number. The data set I have: Data have; Input Name $ Sex $ Unit_number $ unit_alphabet$: $20.; cards; Amy F 103 ,104 Bob M 203 A Carolin F 204 B,205B David M 208 ,210 Emily F 513 C,515 Run; I want the data set looks like: Name Sex Unit_Number Unit_Alphabet Amy F 103 Amy F 104 Bob M 203 A Carolin F 204 B Carolin F 205 B David M 208 David M 210 Emily F 513 C Emily F 515 Thank you!!
... View more