Retail therapy the SAS way


It’s mid-afternoon.  Day 2 of the PRG2 class. Students return satiated from lunch. Some slipped into this course without taking PRG1 so they missed out on some basics. I’m trying to explain how SAS thinks. I use slides, draw pix, do everything except break into dance to get their attention. I can’t blame them –sweltering July heat combined with a post-lunch sense of contentment can make anyone’s eyes glaze over as I mention the PDV.

‘PD what?’ exclaims a mother of three, thinking no doubt of Parent teacher days.

‘Prune Dwarf Virus’ cries out a research scientist rubbing his hands with glee.

‘Petroleus de Venezuela’ shouts the oil tycoon.

‘Police department’ barks the ex-cop in class!

‘No, No, No, it’s the SAS PDV’, I implore trying not to despair.

I realize a change of strategy is required and switch direction. As I mention shopping, a student sits up, then another. Soon the whole class is engaged and nods in understanding. So I thought I’d share with you how SAS thinks with a simple IKEA analogy.

shoppingWelcome to my world--Window shopping, malls, outlets in the US, online shopping, bargaining in markets, I love them all. Shopping mode doesn’t matter. The process is what I love.

What’s my justification to spending hard earned pay dollars?  The economy of course! I’m sure you’ll agree we all have to do our bit as conscious citizens. How can the wheels of the economy churn to come out of recession without our able bodied help?

As someone who tries (but ruefully admits doesn’t always succeed) to smart shop, I’d be amiss if I didn’t mention IKEA. Can you compare the two? I like to think so. So before we get into SAS’ head to see how it thinks and works, let’s talk IKEA first.

How do I put together an IKEA Bookshelf once I’ve brought it home?  I would break it down into 2 phases:


  1. Open the book of instructions & translate it to make sense to myself
  2. Clear out a space in my living room to do the assembly work
  3. Count the nuts and bolts to make sure I have enough of them (if any are missing I’ll have to call the IKEA support line).
  4. Build the outer shell of the bookcase where I’ll lay in shelf by shelf during assembly


  1. Lay out shelf by shelf on the outer shell respecting any special instructions

Now to SAS. How does SAS process and think to build your SAS dataset?  Also in 2 phases:

Compile phase

  1. Translates your code to machine language
  2. Creates the Program Data Vector (PDV)- don’t be frightened by this name, it’s just a temporary space (like your living room for shelf assembly) for doing the work
  3. Scans syntax for any errors and complains in the log if it finds any
  4. Builds a descriptor of your output dataset where SAS reads in your data record by record during execution

Execute phase

  1. SAS reads in your data row by row into the descriptor of your output data set using any special instructions in your code

The joys of shopping! Do you see the similarity between my plain and simple IKEA shopping and highly evolved SA?  So don’t let the PDV faze you in the future. Next time you shop-till- you-drop at IKEA, you just might find yourself breaking into a smile. I’m guessing it’ll probably be because you know without a doubt
that SAS breaks down the work just like you do in 2 phases -compile and execute.

This is a simple interpretation of data step processing.   For more in-depth information, check out the SAS Programming1: Essentials (PRG1) course page.


About Author

Charu Shankar

Technical Training Specialist

Charu Shankar has been a Technical Training Specialist with SAS since 2007. She started as a programmer, and has taught computer languages, business and English Language skills. At SAS, Charu teaches the SAS language, SQL, SAS Enterprise guide and Business Intelligence. She interviews clients to recommend the right SAS training to help them meet their needs. She is helping build a center for special needs kids in this project.

Related Posts


Leave A Reply

Back to Top