Hello, I have a database where 12,000 variables are named "A0122_40", "A0122_45", "A0122_50" and so on. I would like to rename them by keeping in the initial name the numbers from 2 to 5. I would then like to create variables adding all the columns with the same name. I don't know if better to do two steps (rename then create new variable with SUM) or do directly a procedure to create the new variables. I already try the rename step from several ways but it still stop because of errors. Last try was : proc contents data=mine.petitTEST1 out = mine.petitcontents (keep=name where=(name not in ("DEPCOM","NAIS","SEXE"))) noprint; run; data mine.petitTEST2; set mine.petitcontents ; new_name=cats(name,'=','var',substr(name,2,4)); output; run; proc sql; select distinct new_name into : renlist separated by ' ' from mine.petitTEST2; quit; proc datasets lib= mine nolist; modify petitTEST1 ; rename 'A0:' = &renlist. ; run; quit; Message of error was : ERROR 22-322: Expecting un nom.
... View more