BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ballardw
Super User

Another approach may be to not create multiple variables to plot but add an indicator variable as to source/purpose/whatever and use SGPANEL to create one graph panel for each value of the Panelby variable(s).

data temp;
do x=1 to 20;
y1=ranuni(1);
y2=10*ranuni(2);
y3=100*ranuni(3);
y4=1000*ranuni(4);
output;
end;
run;

data toplot;
   set temp;
   array ys(*) y:;
   do i=1 to dim(ys);
      var=vname(ys[i]);
      value=ys[i];
      output;
   end;
   keep x var value;
run;

proc sgpanel data=toplot;
   panelby var /columns=2 rows=2 
                onepanel uniscale=column
   ;
   scatter x=x y=value;
run;

Or SGPLOT and group to overlay

proc sgplot data=toplot;
   ;
   scatter x=x y=value/group=var;
run;

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 4924 views
  • 1 like
  • 4 in conversation