data have; input id $3. mean_arm mean_leg diff_arm diff_leg upper_arm upper_leg lower_arm lower_leg reader_arm reader_leg; cards; ABC 878 787 2 1 8 9 -4 -3 872 788 DEF 600 500 7 4 10 11 -8 -7 590 501 GHI 300 200 12 4 11 8 -11 -10 299 202 ; run; Using a data set like the one above with several body measurements (body part specified in the suffix of the variable name), I made a macro for PROC SGPLOT which plots DIFF_&thissuffix against MEAN_&thissuffix for each body part: %macro graph(suffixes= );
%let nsuffix=%sysfunc(countw(&suffixes));
%do i= 1 %to &nsuffix;
%let thissuffix=%scan(&suffixes,&i,%str( ));
proc sgplot data=have;
scatter x=mean_&thissuffix y=diff_&thissuffix;
run; quit;
%end;
%mend;
%graph (suffixes= arm leg); How do I add a REFLINE statement that makes horizontal lines at LOWER_&thissuffix and UPPER_&this.suffix? For a particular body part, the values of LOWER_&thissuffix are the same for all records, as are those for UPPER_&thissuffix.
... View more