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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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