/* This program removes the FIRST character from each variable name. This, or slight variations of this routine can come in useful when you are programming in SAS. */ options nodate pageno=1 linesize=80 pagesize=60; data fitness; input _Age XWeight ZRuntime WOxygen @@; cards; 57 73.37 12.63 39.407 54 79.38 11.17 46.080 52 76.32 9.63 45.441 50 70.87 8.92 . 51 67.25 11.08 45.118 54 91.63 12.88 39.203 51 73.71 10.47 45.790 57 59.08 9.93 50.545 49 76.32 . 48.673 48 61.24 11.5 47.920 52 82.78 10.5 47.467 44 73.03 10.13 50.541 45 87.66 14.03 37.388 45 66.45 11.12 44.754 47 79.15 10.6 47.273 54 83.12 10.33 51.855 49 81.42 8.95 40.836 51 77.91 10.00 46.672 48 91.63 10.25 46.774 49 73.37 10.08 50.388 44 89.47 11.37 44.609 40 75.07 10.07 45.313 44 85.84 8.65 54.297 42 68.15 8.17 59.571 38 89.02 9.22 49.874 47 77.45 11.63 44.811 40 75.98 11.95 45.681 43 81.19 10.85 49.091 44 81.42 13.08 39.442 38 81.87 8.63 60.055 ; /** This macro will rename all variables, removing the first character **/ %macro vars(dsn); %let dsid=%sysfunc(open(&dsn)); %let num=%sysfunc(attrn(&dsid,nvars)); data &dsn; set &dsn(rename=( %do i = 1 %to # %let var&i=%sysfunc(varname(&dsid,&i)); &&var&i=%substr(&&var&i,2,%eval(%length(&&var&i)-1)) %end;)); %let rc=%sysfunc(close(&dsid)); run; %mend vars; %vars(fitness);