BookmarkSubscribeRSS Feed
Linlin
Lapis Lazuli | Level 10

How Can I create the same graph in EG? not by running the same sas code but by using Tasks -> Graph

Thank you!

proc sgplot data=sashelp.class nocycleattrs;

  histogram height / legendlabel='height' fillattrs=graphdata1  transparency=0.3;

  density height  / legendlabel='height'  lineattrs=graphdata1(pattern=solid) name='1';

  histogram weight / legendlabel='weight' fillattrs=graphdata2  transparency=0.3;

  density weight  / legendlabel='weight2' lineattrs=graphdata2(pattern=solid) name='2';

  keylegend '1' '2' / across=1 location=inside position=topright;

  xaxis display=(nolabel);

  run;


SGPlot.png
2 REPLIES 2
Cynthia_sas
Diamond | Level 26

Hi:

  I'm not sure you can generate the same graph using Tasks. I believe that Tasks --> Graphs will only surface SAS/GRAPH procedures, which does not have quite the same overlay capability as the SG procedures. You might be able to do this with creative use of the ANNOTATE facility, but the SGPLOT code is much easier to use because of the HISTOGRAM and DENSITY statements along with the overlay capability.

  I think if you use Tasks --> Describe --> Distribution Analysis, then you can get 1 histogram; but for 2 overlaid with the procedure that EG uses (I think it's UNIVARIATE), I am pretty sure that you can't get a fancy overlay like you can with the SG procedures.

cynthia

Linlin
Lapis Lazuli | Level 10

Thank you Cynthia! It is good to know. There are no options for me to mark you answer now. It is so strange.

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 1216 views
  • 0 likes
  • 2 in conversation