For this assignment we will work with the dataset GoT.sas7bdat. It includes the information of the characters from the famous TV series Game of Thrones. There was a data dictionary that came with it.
- (30 pts) First let’s check some categorical variables from the data. There is too many information in the dataset. For categorical variables, we may be interested in the following:
Gender, Religion, Social Status, and Intro Season.
Create a macro to show the frequency count of the specified categorical variable (one of the interested variables above).
Note that some of them may be stored as numeric values in the data but each number represents a category. For such variables, create a user defined format for each variable to display the category name instead of the numeric values. Look for this information from the data dictionary.
Use the macro system option MPRINT to help debug the macro.
- (30 pts) Next, we may also be interested in some numeric variables like Survival time or prominence of character. Create a macro that for any specified numeric variable, display the name of the character with the min and max value of that variable. E.g. if looking at survival time, display the name of the characters with the shortest survival time, and also display the name of the characters with the longest survival time. You can use a %DO loop with 2 iterations to achieve this for min and max.
Title your result properly.
- (20 pts) Combine the two macros above to create a new macro that provides the frequency table for categorical variables, and provide the character names with min and max values for numeric variables. Add a flag called isChar (Y or N) as one of the macro parameters to define whether the specified variable is character or not. Note that your macro should not be case-sensitive to this manual input.
- (20 pts) Use your macro in 1.3 to answer the following questions
- Are there more male characters or more female characters?
- Among the people with known religion, which religion was the most popular?
- Which season introduced the most characters?
- Which character(s) survived the longest?
- Which character(s) were the most prominent?