Thank you for the macro. It's very useful when working with data sets created by REDCap code where the default character-variable length is $500. Another modification that might be needed is to increase the length of the variable VARS in the data step OrigOrder2. The variable must be long enough to hold all variable names in the original data set. It could be set to 32767, the maximum length of a character variable or it could be set to 33*Number of Variables (32 for the maximum length of a variable name plus 1 for the spaces between the names.)
... View more