The starting point for anyone interested in becoming a SAS Programmer/Analyst is to understand SAS Base Programming. Courses to learn SAS Base Programming can cost thousands of dollars. I believe learning should be more affordable.
After you complete the course, you will be comfortable to import raw data files, manipulate data, combine SAS data sets, create summary reports, perform statistical tests, utilize the common SAS functions, learn how to clean and reduce your data, and finally learn programming logic.
Test yourself by completing two comprehensive assignments after the Functions Module. They will test your ability to integrate the skills that you have learned. Please ensure that you watch the instruction videos first before attempting the assignments. Download any data sets from the google drive (available in pdf in 1st module)
What am I going to get from this course?
1. Apply beginner to intermediate SAS skills.
2. How to import different data files
3. How to work with data, including merge, filter observations, sort observations, clean and reduce your data, read dates, subset data, utilize conditional logic, and more.
4. Apply the most commonly utilized SAS functions (RAND, LENGTH,TRIM, COMPRESS, and more).
5. Learn all about Arrays and where it makes sense to apply them.
6. Apply informats and formats.
7. Ability to integrate many of the individual concepts through the final project: a case study.
Prerequisites and Target Audience
What will students need to know or do before starting this course?
No software is necessary, however, if you want to follow along, instructions on how to obtain particular software will be provided. We do not endorse any specific software. This specific course was made with a commercial license from WPS.
Who should take this course? Who should not?
Beginners to SAS programming or programming in general.
Individuals wanting to learn SAS Base Programming.
Individuals preparing for SAS Base certification.
Individuals who work for large enterprises, or want to in the future, and are interested in data analysis/data science.
Installing the Software of Your Choice
If you want to follow along with me (which I would suggest), there are a few different software options out there. The google drive link is clickable in the pdf. Make sure to check out the pdf.
Importing a .txt file
In this video, you will learn how to import any .txt file. Importing these types of files is a bit easier than a .csv (which I cover a bit later).
Importing .csv files
Here I show you how to import .csv files.
Permanently Saving Files
Usually, SAS will save your work in a work library. The work library is where SAS stores your files temporarily. If you're interested in saving it permanently, this lesson is for you.
Importing SPSS file to SAS
I show you how to import SPSS files.
Module 2: Working With Data
What if your data file is not separated by a blank space? What if it is separated by a dot (.) or |. I'll explain SAS default delimiters, and how to deal with such a problem!
Reading Data Instream
Sometimes you want to just type your data directly in the syntax. This is logical if you have very little data, and if there is no need to import a file to SAS. I show you how to do it.
Here I show you how to create new variables with the current data that you have. Often new variables utilize current variables, so calculations are often required.
SAS is not great at dealing with data that has dates, and by default it does not present them properly, I will show you what is required to deal with this.
More on Creating New Variables
I talk more about how to go about creating new variables.
Sometimes you only want certain part of your data set to show up. I'll show you how this is possible in SAS. If you are in the real estate business, maybe the boss asks you to show him list of only the homes that cost more than 250k.
One of the ways to subset data is to use the WHERE Expression.
If-then Conditional Logic
i discuss if-then conditional logic in SAS programming.
I show you two new statements..proc sort and by statements. This will inform you how to sort your data.
Merging Two Data Sets
I'll show you how you can merge data from two different .txt files. It is super simple to do in SAS.
Data Reduction and Cleaning Your Data
First, I show you how to use the keep and drop statements in SAS. If you want to reduce your data by keeping or getting rid of certain variables, I'll take you step by step to show you how. Then I show you the rename and label statements that help make your data more "clean". This includes renaming your original variables and labeling those variables.
I discuss the length statement.
Creating a Counting Variable
Creating an enumeration or counting variable is common with survey data!
Working With Data Quiz
Module 3: Informats and Formats And Review of Input Types
Informats and Formats
In this article style lesson, I write a bit about Informats and Formats!
Welcome to this lecture. I thought I'd change it up a bit and give you an article lecture on input types.
User Defined Formats
In this lesson, I'm going to show you how to create or define your OWN formats. This is often neccesary, but it does not have to be difficult to understand!
Formats, Informats, Input Style Quiz
Formats, Informats, Input Style Quiz
Module 4: Common SAS Functions
I show you how to use the rand function. This function allows you to produce a sample (random numbers) with a distribution of your choosing.
LENGTH Related Functions
If you work with large data sets (lots of columns/rows), this lesson will be very useful. Learn about LENGTH, LENGTHC, and LENGTHN functions.
The TRIM function copies your argument(or parameter), and gets rid of trailing blanks(space).
Compress Function (Article Lesson)
I discuss the compress function.
Input and Put Functions
If you want to convert your character variable to a numeric one (ie so you can do analysis on that variable), you have to use the INPUT function. If you want to change a numeric variable to a character one, you have to use the PUT function.
CATX function will remove both leading and trailing blanks, insert a delimiter (or separator), and return a concatenated (merged) character string.
Do you want to only return the 2nd word (John) from a variable that is storing the concacated full name of an individual ie Fisher, John. Well now you can!
The Coalesce function will return the first value that is NOT MISSING from a list of numeric arguments. I use an example where you store someone's home phone number and cell #. It's a good example as it is normal to sometimes have home number but no cell # contact, and the other way around. Well, if there is a value to return, ie at least a home number or cell are present, it will return that available number for you.
The VERIFY function is super useful for data cleaning purposes (ie picking up errors) in a data set. I'll show you one way to use it!
I show you how to use the SUBSTR function, both the right application of it (which allows you to extract a substring) and the left application (which is useful for replacing character value contents).
Arrays 1 (Recoding Variables)
Recoding variables can be time consuming if you go variable by variable..let me show you an easier way! We utilize the do end loop.
Arrays 2 (Constructing New Variables)
Constructing new variables manually is a tedious process when you have many variables that you are working with..let me teach you a simpler way.
Assignment 1. You will be able to test how well you integrate the skills you have learned. Please watch the introduction to the assignment, this is critical.
Assignment 1 Solution
Have a look at the solution once you have tried on your own.
Test if you are a SAS ninja, and if you can integrate the individual skills you have learned.
Assignment 2 Solution
Here is the solution for Assignment # 2.
Module 7: Visual Representation of Data
I show you the ease at which you can create a scatter plot with SAS.
The software you are using for this course may not able to perform the graphs I will show you. Nevertheless, I show you which graphs other than a scatter plot that you can do. Your place of employment will certainly have it.
Module 8: Performing Common Statistical Tests with SAS
Independent samples t-test is one of the more common tests that businesses and corporations do for their data analysis! I'll show you how to to run this test on SAS.
Chi-Square Test of Independence
Here I show you how to perform a chi-square independent groups analysis using SAS.
Module 9: Intro to Macro Programming Basics
Handout for Macro Section
The code for the next two lessons.
Creating A Macro Variable
Learning how to create a macro variable can speed up your coding, by making it easier to modify your data.
Creating A Macro
Learning how to create a macro can give you great flexibility, and help finish your coding much quicker. Time=money.
Module 10: Health Care Case Study
Important Note Before You Begin
Please read before you watch the case study.
Case Study Part 1
This is part 1 of the case study.
Case Study Part 2
Part 2 of the case study.
Full Code for Case Study
Here is the full code for the case study as it is sort of long.