Question
Write a SAS program to do the following in order: 1. Create a SAS library, mylib that connects to the folder U:STA575Exam1. You must first
Write a SAS program to do the following in order:
1. Create a SAS library, mylib that connects to the folder U:\STA575\Exam1. You must first create a folder Exam1 inside STA575 on your U drive and place baseball.sas7bdat inside the folder. The data is also inside the directory C:\Program Files\SASHome\SASFoundation\9.4\core\sashelp.
2. Write a data step that reads observations from the SAS data set baseball.sas7bdat and creates data set one.
Define permanent variable labels using LABEL statement and SPLIT option to display the variable labels in two lines.
Use the labels nHome = Home Runs, nRuns = 1986 Runs, nBB = 1986 Walks, crRuns = Career Runs.
3. Set up your system options so that the page number of your output starts with page 1 and include the date option so that one can see when you produced the final output.
4. Print the data set with labels defined above, print only observations 10 to 15 by using a local option statement.
5. Sort the data in work.one by crRuns in ascending order into a new data set called work.new.
6. Include a global options statement, where firstobs = 170 and obs = 180.
7. Print the variables Team, Salary, nHome, nRuns, and crRuns by using Team as the ID variable. Make sure that the permanent labels are used in the listing. Variables must appear in the order they are listed in the question.
8. Write a data step that reads observations from work.new into work.two.
For questions 9 - 11, print the variables Div, Salary, nHome, nRuns, crRuns with no obs column.
9. Using a local option for firstobs = 10, print the observations in the data set work.two. How many observations are in the data set? Explain the reason behind the number of observations.
10. Reset the global options in question (6) to their default values. Using the data set work.one, write a data step that reads observations from Boston (Team = Boston) and belong to American League East division (Div=AE). Call the data set work.three. Use where statement and print the data set.
11. Repeat question (10). Use if statement and call the data work.four. Compare your SAS log for both statements and comment on the difference(s), if any, between their executions. [For extra two points, which statement would you prefer and why?]
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