Interview Questions   Tutorials   Discussions   Programs   Videos   

SAS - What is the difference between SAS Data step and SAS PROC SQL, and which is better?

asked mar September 20, 2014 06:29 AM  

What is the difference between SAS Data step and SAS PROC SQL, and which is better?


1 Answers

answered By vishnoiprem   0  

Consider 2 ways of grocery shopping:

Method 1: Go directly to the aisles for your products, you may have to ask around to get to the right shelf, but you know exactly where you are going and how you are going to get there.

This is how the DATA Step behaves. It is procedural, meaning that you write a procedure for what you need. Programming languages like FORTRAN, BASIC, C, JAVA, COBOL and SAS have files with records stored sequentially—so processing happens one record at a time. These languages were designed to mimic human behavior in processing paper forms. In SAS, what you ask for is what you get (and how you get it).

Method 2: Give the clerk your shopping list. You have no control over the clerk’s route. They might go to the stock room directly since they know your product is yet to be stocked on shelves. Regardless of the route, the one guarantee you have is that you never know how they did your shopping.

This is how PROC SQL behaves. It is non-procedural, meaning that you state what you want. SQL retrieves data in what it considers to be the most efficient way. SQL was designed to query relational database management systems (DBMS).

1)benefit of PROC SQL is its ability to process unsorted data and create tables in a sorted fashion 2)Performing an OUTER UNION is very similar to the DATA step with a SET statement referencing two or more data sets 3)Establish a connection with a RDBMS a)LIBNAME in dataset b)CONNECT DISCONNECT in proc SQL

   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!