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;

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 4479 views
  • 1 like
  • 4 in conversation