BookmarkSubscribeRSS Feed
ShaneClark
Calcite | Level 5

I use SAS on a regular basis to do analytical work and always found the language extremely awkward to use (For example, structuring data steps, all kinds of weird options, rules for different operations, procs, and handling formats, informats). The whole logic of doing analysis in the SAS language seems counterintuitive and inefficient to me.

Before doing work with it, I was more used to general-purpose languages like Python, Java, etc. Now I understand there is a learning curve when it comes to SAS and admittedly I have not had too much experience with it (<1 yr) but sometimes I find myself tearing my hair out.

So wanted to hear some well thought-out perspectives from some of you experts. Feel free to berate a young, unknowing analyst, offer any ideas at all, explains the pros and cons of sas, just whatever. Give me a lesson!

Thanks in advance!

12 REPLIES 12
ballardw
Super User

Before exposure to SAS I learned general purpose programming languages like FORTRAN, BASIC, PL1 and Assembler. And have done some work with COBOL, Pascal, Ada.

 

I don't know if I would consider myself an expert though I have used SAS off and on since version 5.18.

 

If you learn procedural type languages first the translation to SAS is relatively straight forward IMHO. When you start with object oriented then there is a difference in how things work.

 

Please show me the minimum amount of code to calculate maximum, minimum, standard deviation and number records used for all numeric variables in a data set with groups based on 4 variables, providing the summaries 1) overall , 2) each group individually, 3) all groups of 2 of the group variables taken together, 4) all groups of 3 variables taken together and 5) all 4 variables combined. SAS will do this with 3 lines of code and if your variable names are not long probably under a 120 characters or so. And one of the "lines" of code is "run;"

 

Designed to do different things, SAS is designed around statistical analysis, not having a refrigerator tell you it is time to buy eggs.

 

One person's "weird option" is another person's "key feature".

 

Formats for instance allow you do many different analysis based on groups without changing the data at all. Which for some data sets is much more efficient than to keep adding new variables.

 

 

 

 

 

 

Tom
Super User Tom
Super User

SAS is not A programming language.  The system uses many parts that might be considered languages, but it not really one language, rather more of a collection of interconnected tools. As the acronym that they no longer want to use says it is an Analysis System.

 

You could think of the data step like a language, but not a general purpose language like Java or Python, but one for reading and writing datasets.  You could think of the syntax used in some of the procs as languages (SQL for example or TABULATE).  The macro processor is not really a language as it is just a simple text pre-processor to facilitate templating of code.

Reeza
Super User

Each language has its own benefits. 

 

Some of SAS is the ease of getting output to different destinations, ODS OUTPUT where your results only are piped to various different destinations is great. 

Being able to process 30 million records on my desktop  is also great, when Python would run out of memory or require special handling to handle that amount of data. 

PROC MEANS, FREQ and TRANSPOSE are great and super flexible.

Understanding filter operations using boolean does require some mental gymnastics IMO, I prefer the ability to use WHERE/IF/THEN/CASE statements.

 

You're using a language designed 50 years ago and the majority of things are the same across procs. If you've ever used Python or R in production package management is a nightmare and not even all import (read_csv, read.csv) use the same structure for importing data, some use the keyword file/path and others use other terms that you have to remember somehow? There are sometimes 50 packages to do a single thing, which means your first job is to pick the best package which is somewhat similar to finding a proc, but a lot more complicated because packages may or may not work or be updated or compatible with your current version. 

 

SAS is an Enterprise tool, that tries to abstract a lot of this away from the end user so IT handles a lot of the complexities. 

 

I program heavily in both SAS and R and they both have their advantages.

How python handles missing and boolean will drive a person insane. 

 

SASKiwi
PROC Star

@ShaneClark  - Here is a different spin. Every language has its idiosyncrasies and SAS is no exception. You just get over these and get on with it.

 

I do wonder though how many currently popular languages will last the distance. I've been using SAS since 1981. Would you be prepared to place a bet that Python, Java, R etc will be as popular in 40 year's time as it is now? SAS has that track record for very good reasons. All I'm saying is an investment in SAS will help you avoid your IT skills becoming obsolete.    

Reeza
Super User
How do you like working with languages that offer no backwards compatibility support and break your code nilly willy?
SASKiwi
PROC Star

@Reeza  - Are you referring to Java, Python and R in this regard? I've had very little to do with any of these. I also would not look kindly on no backwards compatibility support. In my experience, it is hard enough doing software upgrades without doing major code rewrites as well. At least with SAS this doesn't happen.

Reeza
Super User

Python and R for lack of backwards compatibility. 

 

Python 2.7 to 3.0 changed print from a statement to a function for example. print() is a foundational concept in most languages and changing something like that in an upgrade is an interesting choice. 

 

 

ChrisNZ
Tourmaline | Level 20

> The whole logic of doing analysis in the SAS language seems counterintuitive and inefficient to me.

I think that this sentence probably says more about the speaker than the topic. SAS was built for doing analysis, and one can write most standard analyses (as in: the most common hundreds STAT, OR, QC, DM etc algorithms and their thousands of variations and options) in a half-dozen lines of code. That code will then process millions of entries in seconds. 

 

Data analysis is the tip of the iceberg though. Data preparation is where the vast majority of the data processing (and programming effort) is spent, and here again SAS was built with just that in mind.

Simple operation in SAS, such as keep the first occurrence of or sum the last three or rolling average are easily implemented in SAS, while they are hard to code in other languages such as SQL, even harder to decipher, and have appalling performance as they often require merging the table with itself.

 

Open any 20 questions this forum's pages, and see how many square-peg data people want to transform because they need it to fit that data in a round hole. It never ceases to surprise me how diverse the data manipulations can be, and how odd some requirements seem. The answer to all these questions usually fits in 25-odd lines of code that will, again, transform massive tables in seconds.

 

Just my biased 2 cents of course. 🙂

s_lassen
Meteorite | Level 14

SAS is not a programming language. It's a data management system, which employs a number of programming languages (e.g. Data Step, Macro, DS2, SQL/FedSQL, SCL, IML). 

 

I suppose that by SAS as a programming language, you mean data step programming. Yes, it takes a little while to wrap your head around that, because there is an implicit loop there. You have to understand that before you will really be comfortable with data step programming.

 

There are a couple of reasons why I think SAS is a good choice for a lot of data transformation tasks:

  • There are interfaces to almost any database or data format you can think of
  • Sequential processing is quite fast, as the data step code is compiled to machine code on the fly
  • Generally you do not have problems with backwards compatibility
  • The macro language is a flexible code generator which beats anything I have seen elsewhere

And of course SAS is great for analytics and reporting as well, using the procedures available in Base SAS, not to mention all the other packages, (e.g. SAS/Stat, SAS/ETS).

 

But yes, it takes a bit more time to get acquainted with a data management system than with a programming language.

Patrick
Opal | Level 21

@s_lassen "It's a data management system" - You're leaving out all the analytics bits which are rather relevant. ...and then there is now Viya adding a whole new "layer" you haven't even touched on.

Ksharp
Super User
If you want to do analytical work ,you need to learn more math and statistic things, SAS Python or R are just a tool .
SAS can process/model big data better and faster than Python ,R .
My favorite about SAS is its data cleaning power ,When you are facing a big messy text file ,the best choice is SAS .
And SAS have other gems which Python R don't have , like OR QC .
SAS drawback is need-pay and no-open software .
smantha
Lapis Lazuli | Level 10

SAS is not a General Purpose Programming Language. 

Every Language IMHO has a soul. If you understand the soul you understand why the language is there in the first place. Used different programming languages over the years and consider myself sufficiently qualified to draw comparisons. When I saw Java/C# code for the first time I was thinking why you need twenty lines of code (an exaggeration) just to print "Hello World". Then I saw Python and Ruby and I was like this is so much simpler to do and learn. When it comes to performance may be Java or C# is faster as the code is compiled into byte code and not interpreted. 

As my experience grew I realized the difference between compiled and interpreted languages, Object Oriented and Functional languages and something like SAS that has features from all of those. For people who do not know SAS or just started using it, depending on which programming language they come from, looks absurd. One has to remember they just scratched the  surface and worked with one facet of SAS i.e. Base SAS and at the most STAT and Graph. There are at least 10 other components of SAS that people do not come close to working with such as AF/SCL, Connect, IML, OR etc. that people use in specialized situations. The crux of all that is data used for analysis is tabular and the only product that can even come close in handling the variety , features performance etc. is  R that too by a distant second. Python claims the second spot, but you ask a true statistician he will tell you hands down that it can address machine learning / prediction questions and barely addresses real statistical tests. SAS gives all of this in a package.  

I have to give it to SAS for the following features

1. Easy to debug. IDE for SAS comes default also called DMS. Lends itself to Command Line nicely as well.

2. Great support documentation (Every where else is open source I understand)

3. Succinct Error reporting that people understand no verbose logs of all possible errors in all libraries

4. Comprehensive STAT suite and reporting to go in sync with it.

5. If SAS a module is optimized for performance or there are notes on how you could do that.

6. Consistent and reliable

7. I do not have to depend on tribal knowledge except for some cool tricks on how people solved some problems.

I saw people who could make SAS sing to their tunes because they understand pdv (program data vector), and understood the behind the scenes of SAS. Same as other programming languages you need years of expertise to get to that level. You need good mentors and a curiosity!

PS: Please understand the soul of any programming languages before making such comments.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 12 replies
  • 21489 views
  • 23 likes
  • 10 in conversation