data trees; input name:$8. height; cards; Maple 123 Maple 78 Maple 90 Elm 155 Elm 65 Elm 90 Elm 120 Birch 100 Birch 30 Maple 111 run; proc means data=trees nway noprint; class name; var height; output out=meansd mean=meanheight std=sdheight; run; data _NULL_; set meansd end=last; call symput('mean'||left(_N_),meanheight); call symput('sd'||left(_N_),sdheight); call symput('name'||left(_N_),trim(name)); if last then call symput('numspecies',_N_); run; %PUT _USER_; %MACRO treestandardizer; data final; set trees; %DO i = 1 %TO &numspecies; if name="&&name&i" then stheight=(height-&&mean&i)/&&sd&i; %END; %MEND; options mprint; %treestandardizer proc print;