I memorized a lot of the top SAS functions. However, what is the computer thinking or doing when it is executing a function in the data step? I have a taught myself a lot in the last few months. However, I don't have a strong enough grasp of the PDV and what the computer is exactly doing. Any suggested resources to help me understand better?
A big difference is whether a function is called in an IF or a WHERE statement.
WHERE statements are applied before the PDV is loaded, so the functions can't access the variables from the PDV and are often much slower than the same functions used in an IF statement.
What is this is the code I am running?
data mixed;
set learn.mixed;
Name = upcase(Name);
run;
The observation is read into the PDV and then the upcase function is applied to an observation. This is before it moves the next observation that is read in and then the function is applied to it?
1. The SET statement loads the data from LEARN.MIXED into the PDV
2. The upcase function update the value of a variable in the PDV.
3. The run statement triggers an (implicit) output in the MIXED table.
4. The iterator go to the top of the data step. Executes 1. again if more observations are available.
Do what many SAS programmers have never done...read this:
https://documentation.sas.com/api/docsets/lrcon/9.4/content/lrcon.pdf
When I was first learning SAS a billion years ago, this was about 120 pages. How times have changed.
It's (now) a big doc - skip the parts you don't need right now (eg. Part 3 if you don't have CAS).
But if you do invest the time to read this over a couple weekends it will serve you well.
Start with Chapter 20 if you want a head start, but I recommend you read most of this document.
I agree with @ScottBass Reading the Concepts is seriously worth it. You don't need to understand everything that's in it as a beginner. Just make it a habit to browse through this documentation from time to time as you'll pick-up more and more as you progress and even more importantly you start to understand where you can tweak your coding approaches to better align them with how SAS works.
The online version of the SAS Language Reference: Concepts is found here.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: