 Hello, thank you for joining me, Monica Wahee, in your journey as you learn to use SAS on Demand for Academics, otherwise known as SAS ODA. In this video, I'm going to show you how to look at the contents of a dataset using PROC contents in SAS ODA. Okay, here we are in SAS on Demand for Academics or SAS ODA environment. If you need help setting up your free account in SAS ODA, you can take my free online course called APLI, getting started with SAS ODA. I'll link you to it in the description. Okay, so assume you got started with SAS ODA and now you can open a program window. And let's say someone gives you a SAS dataset. Actually let's say I give you a SAS dataset and tell you to get it into SAS ODA. Actually, if you don't know how to get this dataset into SAS ODA, I have a video I'll link you to in the description. But go out to GitHub and get this dataset and put it in. So this is our dataset that I put in SAS ODA. It's called CHAP 6 underscore 1. See this folder X? I made that and uploaded the dataset to it. See this libname command? I use this to map to X. This is all in my other video. Okay, let's first look at this data step. We see it says data brfss underscore a as the first line. What does that mean? It means we are telling SAS to output a dataset named brfss underscore a into the work directory, which is SAS's working memory. That way, the processing will run faster, but the downside is that the working memory gets wiped when we log out, so we can't do anything enduring. The next line is set X dot CHAP 6 underscore 1. This refers to our dataset. So this tells SAS to read that dataset called CHAP 6 underscore 1 in the X libname into memory. So those data step commands just get this dataset into SAS's working memory, naming it brfss underscore a along the way. But what is in brfss underscore a? Let's see by using PROC contents. So this code runs PROC contents on brfss underscore a without any options. Let's run this data step code and this PROC contents code and see what happens. Let me highlight and run. Okay, so this sends us to the results tab. Let's look at the top output table. Here are two important pieces of information in the top of the PROC contents output, dataset name and number of observations. If you are processing lots of datasets over and over, like you do in a data warehouse, you are always running a PROC contents and you are always renaming datasets and changing the number of rows in them. That's why you should really look up here first before you read the rest of the output. You want to make sure you are reading the contents for the right dataset. Okay, let's scroll down to the last table, which lists our variables. Wow, look at these variables. These variable names are something else. See this number sign and this column titled variable? This says the number of the column in the dataset, like the first variable in the list, which is named ADDEPEV2, is actually the tenth column in the dataset. So how did SAS know to put it first? Well you might have noticed that default PROC contents lists the variables in alphabetical order. That's why ADDEPEV2 is first. Okay, let's use an option on PROC contents to make it list the variables in the order of the columns. Let's go back to our code. See this next code? This code has an option after I state the dataset. It says VARNUM. That's the option to make PROC contents sort in order of variable number. Let's highlight and run this and look at the order the variables come out in this time. Aha, this looks more normal now. Notice how the first variable is underscore state. This is a pretty important variable in the dataset because the dataset is a national health survey in the United States. So the state variable is very important. You can see the other variables in order 1 through 12. See these columns? Type, LEN, FORMAT and INFORMAT. In this output they don't look very helpful. They are helpful when you are trying to change the variable type as you can see in the type column or the variable length as you might suppose by the LEN column. Format and INFORMAT are also SAS functions that have to do with variable formatting. Again, these concepts are not so important in this video because we are not trying to manipulate the format, type, or length of these variables. But if we were, we would really need to be running PROC contents a lot, like each time we did an operation to see if we were adjusting the type, length, format, and INFORMAT correctly. Hey, if SAS looks hard and you want to be easy on yourself, take my free online course on how to use SAS on demand for academics. All these lessons are based on my popular book, Mastering SAS Programming for Data Warehousing. I'll link to these in the description. Thanks for watching and have a wonderful day.