Daily Entry #2- 6/9/2024
- Varun Vuppaladadiyam
- Jun 9, 2024
- 2 min read
Today, I've learned more SAS
On SAS, I've learned more about macros and how to create them. You set a string equal to the macro you're setting and you can continue to use them as you wish throughout the code. It's interesting as it's only a string, so you can't skip out on syntax. You can define the macro like this:
%let <variable_name/column_name> ="<string/specific column value>"
I also learned more about the proc freq command, and about the table function, as you can just type:
table <variable> <optional second variable that will create the second table>
which happens right after the initial proc freq command. I also learned about the where function, which is used to filter for specific values, not to be confused with the var step, which filters for specific variables. The where function is defined in these ways:
where <variable> like '<string>' (must be double quotes if using macro)
where <variable> = <numeric value>
where <variable> is missing (which just gives you missing values)
These are only small examples of what you can do as you can do more inequalities with numeric values and there are more options for filtering for missing/null values. I also learned more about proc sort. Proc sort (capitalized proc as I wanted this to look more grammatically correct but it really doesn't matter, right?) works like other proc procedures, but you can add nodupkey and dupout to show tables of duplicated values, and can also apply where functions here to ensure that the sorting function sorts in a way that is to your preference. You can also keep certain values by doing as such:
proc sort data=<file path>(keep= variables you want to keep) out=<tablename> nodupkey dupout <tablename>;
by descending <variables you want to sort by>
A fun fact is that SAS automatically does ascending values so you must specify descending to get descending values.
For SAS, I feel like I'm making good progress and have gotten to work on cleaning some datasets. I want to continue to do more learning from the website as well as continue slight project work here. Overall, a good day for learning SAS for me.
I didn't get enough time to look through Kaggle nor did I get much time to look through the statistical textbook. Tomorrow I'll have to work more on learning ML and I'll need to start and finish the statistical textbook's second chapter's problems. I'll read through the second and third chapter of the Bowles ML book, but will have to go back tomorrow to make sure that I understand the content on a level that I'm comfortable with.
Comments