I'm looking to apply a substring function to all columns in a dataset. Currently I've only had success doing it to one column at a time, but this isn't efficient or viable as this is a macro that won't always know the names or the amount of columns(There's also 100's of columns) data have: Var1 Var2 Var3 ... VarN 01-AB NA NA 99-XX NA NA 14-EF 99-XX NA 08-BC NA 99-XX data want: Var1 Var2 Var3 ... VarN 01 99 14 99 08 99 As I said I can achieve the desired result using the below code, but I have to specify the column names. Really, I need the following function to apply to ALL columns, without specifying their names. I ran into the same problem using the compress function. data Have; set Want; length var1 4; var1 = substr(var1, 1, index(var1, '-') - 1); run; Thanks in Advance
... View more