As far as I am aware there is not way to do what you're asking directly. I would suggest instead writing a short macro loop to do what you're trying to do:
%macro loop;
proc sql noprint;
select distinct symptom,label into :vlist separated by '|',:llist separated by '|' from database;
quit;
%do i = 1 %to %sysfunc(countw(&vlist,|));
proc sgplot data=database;
where symptom="%Qscan(%superq(vlist),&i,|)";
scatter x=VisitNum y=Mean / groupdisplay=cluster group=Treatment;
yaxis label="%qscan(%superq(llist),&i,|,m)";
run;
%end;
%mend;
%loop;
For the above code to work you would need to have another variable in your dataset, which I named label above, to contain a string you want the y-axis label to be. If you are using output statements to make your long version of your dataset you can use the VLABEL function to grab the label from each variable automatically.
If you instead of a dataset where you have the variables in separate columns instead of rows, you can instead make your loop with a %let statement:
%macro loop;
%let vlist=var1 var2 var3 var4;
%do i = 1 %to %sysfunc(countw(&vlist,|));
proc sgplot data=database;
scatter x=VisitNum y=%scan(&vlist,&i,|) / groupdisplay=cluster group=Treatment;
run;
%end;
%mend;
%loop;
This method would then use the labels from the variables themselves to be the y-axis label.
... View more