Monday, September 17, 2012

Last day of the Ramp-up course available

I have posted videos corresponding to Day 3 of the ramp-up course for R and SAS.

The videos cover how to create tables, contingency tables, and graphical and numerical summaries in R (1 video) and SAS (2 video). They cover various commands in R, including tables(), barplot(), boxplot(), hist(), and the commands for numerical summaries and using tapply() to apply a function to a variable based on subgroups; and in SAS as well, including PROC FREQ, PROC TABULATE, PROC FORMAT, and SET in DATA steps. Hopefully the videos are clear (resolution wise) and comprehensive enough. If I have left out anything please message me about it. The other 2 SAS videos can be found here:


It should be noted I did not make videos for the last section, Testing and Regression; we will address this during the course of the semester. However, there is something we should discuss, how to create a subset in SAS. To do this we use the DATA step in a manner similar to creating a new variable, which was mentioned in Creating Tables in SAS. If, for example, you wanted to only look at the hotdogs where the type is Beef or Poultry, we do:
DATA hotdogs_subset;
   SET hotdogs;
   WHERE Type = "Beef" OR Type = "Poultry";
RUN;
Another way is to do:
DATA hotdogs_subset;
   SET hotdogs;
   WHERE Type NE "Meat";
RUN;
This option only works because there are 3 types and we don't want the Type being Meat; NE stands for "Not Equal". We can also do other conditions, such as looking at only healthy hotdogs, i.e. Calories < 150:
DATA hotdogs_subset;
   SET hotdogs;
   IF Calories < 150; /* Comment: IF and WHERE are often interchangeable */
RUN;

Hopefully this is clear enough, if not I'll make a video tutorial to cover this concept.

No comments:

Post a Comment