Question: (35 pts) Write SAS statements to create a new SAS data set called album and add variables as requested below. Be sure to precede each
(35 pts) Write SAS statements to create a new SAS data set called albumand add variables as requested below. Be sure to precede each part of the data step with a comment giving the question number and a brief description of the task. For example:/* 3.1: rank, album and band*/ . All steps can be done in one data step.
1. Write a SAS code that creates a variable that has rank, band, and album information together. It should look like, for example, "#1: Slippery When Wet, by Bon Jovi". Pay attention and be sure to add meaningful special characters such as "#" ":" and "," where necessary. Use thestripfunction to take care of leading and trailing blanks when defining this variable.
2. Write a SAS code that creates a variable showing the number of words in the Title variable. Only use space as the delimiter.
3. For those titles with multiple words, find the second word and store it in a new variable.
4. Write a SAS code that creates a variable indicating whether the band's name includes the special character "&".
5. Write a SAS code that creates a variable showing the length of the album's name.
6. Write a SAS code that creates a new variable to combine the album's name and its year of publishing, with the year in parenthesis. For example, "Slippery When Wet (1986)".
7. Write a SAS code that creates a new variable that divides the albums to the following groups :
- Top 3,
- others
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
