Hi everybody,
I am a new SAS user and I'd need your help.
I have a dataset having a single variable with multiple rows in each of which a string is contained. This last must be divided according to a given positions and length, this data (positions and length) are contained in another dataset.
Example:
Dataset containing positions and length: Length Position 2 1 1 3 8 4 Dataset to be divided: VAR1 abc0123def0 kol1256oiu1 The solution I found is to use the substr function for each variable, writing manually the positions and length: data output;
set input;
var_1=substr(VAR1, 1, 2);
var_1=substr(VAR1, 3, 1);
var_1=substr(VAR1, 4, 8);
drop VAR1;
run; but this method is slow, is there a faster and more automatic method? Thank you 🙂
... View more