BookmarkSubscribeRSS Feed
Obsidian | Level 7

I am a Ph.D. in medicine and have used SAS for a year and a half now. When starting my studies, I had to choose between SAS and R. The research-community in medicine in Denmark is split roughly 50/50 in SAS and R-users, with young, new users tending to choose R due to it being Open Source.


I chose SAS because most people at my department used it and it seemed like an easy way to get going. I have previous experience from Python, but wanted an easy start from the get-go. Now, SAS is very intuitive for data-management and most statistics (although the syntax for a statement like CONTRAST in Phreg is very unintuitive compared to the R-alternative).


I have grown to like SAS a lot, and therefore it both baffles and hurts me, that the graphical capabilities are so inferior to R. I hate having to export my datasets to be able to do what in R takes half an hour, but in SAS takes several hours and obscure code. I am sure that this is one of the reasons that SAS is loosing foothold in this battle.


How come a company with so big economic muscles and market-dominance doesn't prioritize this aspect of the program? Why can't you output vector-formats easily for editing in other programs? Why isn't there a wizard or some easy code, that recognizes all the typical objects you want to be able to manipulate, when having created a graph? I mean most of these functions are from a coding-perspective not that advanced compared to all the other mechanisms in SAS.


I hope that this side of the program will get some more attention - and a fresh new Googly/Apply-approach in the future! 

Super User

What makes you think you can't export vector graphics from SAS? Check the documentation for SVG (scalable vector graphics). Are you talking about the older SAS/Graph output or ODS Graphics output? Many shops seem to have not noticed that 10+ years ago SAS started expanding the graphics using newer statistical graphics procedures than the much older Gplot and Gchart procedures.


Without seeing the data and the code there is no way to discuss the " able to do what in R takes half an hour, but in SAS takes several hours and obscure code". Depending on the sophistication of the SAS coder there are often choices made that are not efficient, just like any programming language. As for obscure code, I think the R is much more obscure than SAS but that may be because I have used SAS for more than 30 years.


I will say that my introduction to R left a very poor taste in my mouth. We had a trainer set up about 25 R installs to conduct a very limited introduction to R. At least 7 of the machines would not run the R code the instructor used for one or more of the demonstrations. Remember, the install was done by the instructor.


SAS Enterprise guide has lots of "tasks" that are point and click.


Have you ever used the SAS ODS Graphics Editor?



Meteorite | Level 14

Which SAS graphics are you using? SAS/Graph (proc gplot, gchart, etc), ODS Graphics (sgplot, etc), Enterprise Guide interface, Visual Analytics, or other?


In the little bit I used R graphics, the two main problems I ran into were: 1) it was cumbersome to create web output with mouse-over text and drilldown URL capability, and 2) there were lots of different user-contributed packages out there to do similar things, and it was difficult to tell which was the best (and which were old/obsolete/no-longer-supported/etc).

Super User
All the things you are talking about could make it happen in SAS . But you need to learn a lot more things than R.
SAS V.S R , just like Oracle V.S. MySQL . Which one you would choose ? paid(Oracle) or free(R) ?
One more thing ,when you get stump by a special problem/bug ,you can ask for help from sas support. But for R, who gotta save you ?

Just to be sure you've seen examples of ODS Graphics, run the SG procedure examples below to see some sample output. The Graph Template Language (not shown below) is at the heart of the system and can be used to create even more powerful ad hoc graphs. There are lots of papers and documentation on the web for using the SG procedures and GTL. Is your concern that this system is more complicated than R?


title "Cholesterol Distribution";
proc sgplot data=sashelp.heart noautolegend;
yaxis offsetmin=0.05;
histogram cholesterol;
density cholesterol;
fringe cholesterol;

title "Sales by Year and Region";
proc sgpanel data=sashelp.prdsale;
panelby region / novarname;
vbar product / response=actual group=year groupdisplay=cluster;;

title "Car Mileage";
proc sgscatter;
compare y=horsepower x=(mpg_city mpg_highway) /
        group=type loess=(clm nogroup);
Barite | Level 11

If I'm being honest this whole post seems like something an immature person trolling a message board would post, so I hope that is not the case.


As a 12 year SAS programming veteran who specializes in making graphics I would strongly disagree with everything you have said.  I don't know if you're sticking to really old graph procedures like PROC PLOT or something, but SAS has been extensively increasing their graphing capabilities over the last decade starting in SAS version 9.2 with the SG procedures.  Not only do they take feedback from the community on here and at conferences to create new plotting statements (TEXT and AXIS plots to name a couple), but they gave us access to the code behind the code with the Graph Template Language so you can create basically anything you want.  I've even been able to design CIRCOS, SANKEY, and other types of graphs that SAS does not have statements for currently using some basic math and programming.  Since SAS 9.3 all those years ago they have been able to output scalable vector graphics that are editable (PDF documents editable with Illustrator or Adobe Acrobat Pro, EMF that are editable in PowerPoint, and even PS files).  I have never had to go to R to make any graph that we send to publication.


If you prefer the style of coding R has then I would go to R.  It's object oriented which is completely different than SAS, and the open sourced nature requires a lot of trust in the contributors that they are being accurate under the hood.  I can spend hours in R just trying to figure out which package I should use and how to even use it because of the terrible documentation and horrible error messaging.  I have no idea how I would make a Kaplan-Meier curve to the same quality my %NEWSURV macro does using R instead or which package I'd even start with since R can't plot text tables worth anything.


Again, I hope you are not being a troll on this forum.  Next time I suggest asking question about how to do something with SAS graphics instead of assuming it can't and going to R.

Meteorite | Level 14

Jeff makes a very valid point.  If you have a question about a specific plot you need to make, please share some code you have tried with sample data (or using one of the SAS built-in data sets).   There are many folks on this community that will go to great lengths to help you get the result you need.   Imho, SAS ODS Graphics + SAS/GRAPH software can create almost any visual.

Meteorite | Level 14

If you're wanting to learn how to do in SAS, some of the graphs you do in R, here are some examples where I provide both the R and the equivalent "obscure code" in SAS, to create the same graphs. This doesn't necessarily solve your problem, but it seems like something that might help you:


Obsidian | Level 7

Thank you for all your replies and helpful tips.

So, first off I think an apology is called for. I am not an internet troll and reviewing my initial post, I recognize the content as both provocative and inconsiderate towards users of the forum. Please know that it was a product of frustration. I am often in company with other students and university staff, who favorize R and praise its functionality a lot.

Also i see, that my search on graphical editing in SAS was not extensive enough. It seems there are plenty of possibilites within SAS containing the exact features I was looking for. I do think though, that a lot of the inputs you gave me here are harder to come by without prior knowledge. Searching on Google, YouTube and Stack Overflow you are quickly met with a lot of easily accesible R-content, the same is not true for SAS, unfortunately. The SAS documentation is very thorough and extensive, but its not exactly user-friendly, especially if you are new to the SAS-ecosystem, which I definetely still regard myself as.

So, to sum it up, thanks for pointing me in the right direction, and for having a forum with a friendly community and quick replies.

(Ps. And even though it hurt a bit, a mild internet scolding is sometimes needed 🤗 )

Barite | Level 11

Thank you for replying with this follow-up, it was nice to see.  We do all get frustrated with programming.  I would say in my experience I do not typically find answers on Stack Overflow as you have stated as well.  This website (SAS Communities), conference papers (PharmaSUG, SAS Global Forum and others), and blogs (Graphically Speaking) are the prime resources for coding issues.  I would say posting a question/issue/request for coding help on this forum is generally answered within a couple of hours.  I enjoy surfing these boards looking for things I can help with or new graphs I hadn't thought to try to make, and the actual SAS developers are very active on here.

Super User

"who favorize R and praise its functionality a lot."
Because R is free , lead it to more person to use R than SAS.
And make them ignore the beauty of SAS.

Barite | Level 11

It's very easy to connect SAS to Javascript and produce incredibly interactive, beautiful graphs & charts.   You can do this from Desktop SAS, SAS 9 Stored Processes, or Viya. 


We use the SASjs framework extensively for this type of thing in our SAS Apps team.

SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 9 in conversation