编程代考 1. Report for missing data (10 marks) – cscodehelp代写

1. Report for missing data (10 marks)

a. Create a new program. Write a PROC PRINT step to read the pg1.eu_occ data. Use a WHERE statement to list rows where Hotel, ShortStay, and Camp are missing. Run the program. How many rows are included?

b. Print observations with Hotel values greater than 40,000,000. Run the program. Which months are included in the report?

2. Use macro variables to subset data in procedures (10 marks)

a. Write a PROC FREQ step to analyze rows from the SAS data pg1.np_species. Include only rows where Species_ID starts with YOSE (Yosemite National Park) and Category equals Mammal. Generate frequency tables for variables Abundance and Conservation_Status.

b. Write a PROC PRINT step to show the same subset of observations from pg1.np_species. Include Species_ID, Category, Scientific_Name, and Common_Names in the report.

c. Create a macro variable named ParkCode to store YOSE, and another macro variable named SpeciesCat to store Mammal. Modify the code to reference the macro variables. Run the program and confirm that the same results are generated.

d. Change the values of the macro variables to ZION ( Park) and Bird. Run the program.

3. Sorting the data and produce an output table: Create the np_sort data that contains data for national parks ordered by regional code and decreasing numbers of daily visitors. (10 marks)

a. Use the PROC SORT step to read pg1.np_summary and create a temporary sorted dataset named np_sort.

b. Use a BY statement to order the data with Reg and with descending
DayVisits.

c. Add a WHERE statement to select Type equal to NP. Submit the program.

4. You have a text file called “geocaching.txt” with the following data arrangement: (10 marks)

Description

Cache name

Latitude degrees

a. Create a SAS temporary data set called “Cache” using this data file. Use the Column input to read in the data values.

b. Repeat the above task but use formatted input to read the data values instead of column input.

5. Using the SAS data “Sales”, show observations for employee numbers (EmpID) 9888 and 0177. Complete this task in two ways, one using OR, and the other using IN. (10 marks)

6. Using the SAS data “Blood” to generate a new temporary data set including all variables in “Blood” and one new variable CholGroup with the following definitions: (10 marks)

7. Use the following program to create a temporary SAS data called “Vitals”: (10 marks)

data vitals;
input ID : $3.
Age Pulse SBP DBP;
label SBP = “Systolic Blood Pressure” DBP = “Diastolic Blood Pressure”;
datalines;
001 23 68 120 80
002 55 72 188 96
003 78 82 200 100
004 18 58 110 70
005 43 52 120 82
006 37 74 150 98
007 . 82 140 100

Use the data set, create a new data named “NewVitals” with the following new variables:

For subjects less than 50 years of age:
If Pulse is less than 70, set PulseGroup equal to Low; otherwise, set PulseGroup equal to High.
If SBP is less than 130, set SBPGroup equal to Low; otherwise, set SBPGroup equal to High.

For subjects greater than or equal to 50 years of age:
If Pulse is less than 74, set PulseGroup equal to Low; otherwise, set PulseGroup equal to High.
If SBP is less than 140, set SBPGroup equal to Low; otherwise, set SBPGroup equal to High.

Assume that there are no missing observations for Pulse or SBP.

8. Work on the following program so that each observation contains a student number (student), starting with 1: (10 marks)

data test;
input Score1-Score3; datalines;

Leave a Reply

Your email address will not be published. Required fields are marked *