Question
Refer to the SAS dataset tm.subscribers. a) Arrange the subscribers in ascending order by the package that they subscribe to and within the same category
Refer to the SAS dataset tm.subscribers.
a) Arrange the subscribers in ascending order by the package that they subscribe to and within the same category of the package, arrange the subscribers in descending order by tenure days. Do not replace the original data set.
b) Display the sorted data set created in b).
Display only Cust_ID, Age, Gender, Package and tenure days
Select subscribers who subscribe to the package after 31 December 2016.
Group the subscribers by the package that they subscribe to.
Display an appropriate two-line title.
Display the label.
c) Using the tm.subscribers as input data, create a new permanent SAS data set enjoy30 as follows:
Select only subscribers who subscribe to the package "WiFi Enjoy 30Mbps.
Variables Superman_Pack, The_Flash_Pack, Batman_Pack, Hulk_Pack and Sports_Pack are formatted as Y = Yes and N = No,
Include a new variable promotion whose values are as follows:
Installation date | Promotion |
Before or on 31 December 2016 | Before Promotion |
After 31 December 2016 | After Promotion |
Exclude variables termination_month, termination_reason_code and termination_reason_category.
----------------------------------------------------------------------------------------------------------------------------------------------------------
The raw data files FiveMbps and Twenty Mbps contain the following variables:
Variable | Field |
CUST-ID | 1-7 |
AGE | 9-10 |
GENDER | 12-17 |
REGESTRATION_DATE | 20-26 |
PACKAGE | 31-47 |
SPEED | 51-56 |
TENURE | 58-62 |
a) Convert both raw data files to SAS format. Use appropriate input style to read the variables. b) Create a new permanent SAS data set Overall that combines observations from both SAS data sets created in a). The registration date must be stored as SAS date values. C) Print the Overall data set. Use CUST_ID as the ID variable.
The results of a Mathematic Competition are stored in the SAS data set Marks.
Variable | Label |
STUDENT_ID | Student's Identification number |
SCHOOL | School (1 = SMK Puteri, 2 = SMK Cabang Tiga, 3 = SMK Dato' Harun) |
M1 | Mark for first round |
M2 | Mark for second round |
M3 | Mark for third round |
a) Use the Marks data set to create a new permanent SAS data set Results. The new data set should contain the followings:
i) An array that contains the marks for the three rounds.
ii) A temporary array that contains the passing mark for each round as follows:
Round | Passing Mark |
First | 70 |
Second | 60 |
Third | 50 |
iii) An array that stores the status (passed/failed) for each round.
iv) A new variable Average that stores the average mark for the three rounds.
Your data (first three observations) should appear as follows:
Obs | STUDENT_ID | SCHOOL | M1 | M2 | M3 | S1 | S2 |
1 | STT001 | 1 | 85 | 80 | 83 | Passed | Passed |
2 | STT002 | 1 | 84 | 75 | 74 | Passed | Passed |
3 | STT003 | 1 | 77 | 56 | 53 | Passed | Failed |
b) The winner of the Mathematic Competition is the one who passed all three rounds and obtain the highest average mark. Display the data set with the winner appears on top.
c) Use PROC SQL to create new temporary SAS data set Over80 which contain only students who obtain average mark more than 80. Do not include the variable status (S1-53) to the new data set.
d) Consider the following SAS codes:
proc print data = Over80;
where School = 1;
run;
proc print data = Over80;
where School = 2;
run;
proc print data = Below80;
where School = 2;
run;
Modify the above SAS codes by using macro variable so that only a single PROC PRINT is needed to display observations from different schools stored in both Over80 and Below80 data sets.
THE END
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started