Homework 01 PDF

Title Homework 01
Author Zahra Sajedinia
Course Statistical Programming And Data Management
Institution Purdue University
Pages 2
File Size 143.7 KB
File Type PDF
Total Downloads 2
Total Views 160

Summary

Homework 1 questions...


Description

STAT 506: Homework 01 You should first download the Data folder for the Programming 1 course from Blackboard; it is available in a zip file called “pg1.zip.” You will need to unzip it after you download it. Make sure it is in a location that is accessible from where you are running SAS. The folder contains all the datasets and SAS programs that go along with the SAS course we are following. In all cases, when submitting the programs, the infile statement should have the correct location of the “pg1” folder specified. You can either leave the infile statement as is and add the macro %let line, or you can edit the infile statement. So, for example, if I put the “pg1” folder on my W: drive, then I could add at the beginning of my program: %let path=W:\pg1; Alternatively, I could edit the infile statement to look like this: infile "W:\pg1\country.dat" dlm='!'; Also, in the assignments when I ask for you to “submit a screenshot”, all you need to do is push the ‘Print Screen’ button on your computer (or use the Snipping Tool in Windows or Shift-Command-4 on a Mac) then paste the image into your homework submission. Also, any time there are italicized instructions at the end of a step, those are my instructions for you to show me your work. So for example on #4c, “Submit the code and the output” means you will actually show me the code and the output in your homework assignment that you turn in to me. Do the following problems. 1. Submitting a Program and Using the Help Facility a. With the appropriate Editor window active, open the SAS program p102e01. Submit the program for execution. How many rows and columns are in the report? rows: __________

columns: __________

b. Examine the Log window. Based on the log notes following the DATA step, how many observations and variables are in the work.country data set? observations: __________

variables: __________

c. Clear the Log window (SAS windowing environment only; Hint: “Edit” in the menu). Take a screenshot. 2. Setting Up a Function Key to Clear the Log and Output Windows (SAS Windowing Environment Only) a. Select Tools  Options  Keys to access the KEYS window. The KEYS window is a secondary window used to browse or change function key definitions. Type the following commands in the Definition column for the F12 key: clear log; clear output Take a screenshot to show your work. b. Which key is programmed to submit a KEYS command? ______ c. Close the KEYS window. This saves the key definition in your user profile. Press the F12 key and confirm that the Log and Output windows are cleared. Take a screenshot to show your work.



It is not necessary to clear the Log and Output windows in SAS Enterprise Guide because this is done automatically each time a program is submitted.

3. Diagnosing and Correcting Syntax Errors a. With the appropriate Editor window active, open the SAS program p102e06. Submit the program and use the notes in the SAS log to identify the error. State the error. b. Correct the error and resubmit the program. Show the final code and the output showing the first five observations.

4. Diagnosing and Correcting Syntax Errors a. With the appropriate Editor window active, open the SAS program p102e07. Submit the program and use the notes in the SAS log to identify the error. State the error. b. Correct the error and resubmit the program. Show the final code and the output showing the first five observations. 5. Examining the Data Portion of a SAS Data Set a. Open the SAS program p103e01. After the PROC CONTENTS step, add a PROC PRINT step to display all observations, all variables, and the Obs column for the data set named work.donations. Show the code you added. b. Submit the program to create the PROC PRINT report below. The results contain 124 observations. Partial PROC PRINT Output: Obs 1 2 ... 124

Employee_ID

Qtr1

Qtr2

Qtr3

Qtr4

Total

120265 120267

. 15

. 15

. 15

25 15

25 60

121147

10

10

10

10

40

Show the output showing the first five observations.

6. Examining the Descriptor and Data Portions of a SAS Data Set a. Open the SAS program p103e02. After the DATA step, add a PROC CONTENTS step to display the descriptor portion of work.newpacks. Show the code you added. b. Submit the program and answer the following questions: How many observations are in the data set? ______________________________________ How many variables are in the data set? _________________________________________ What is the length (byte size) of the variable Product_Name? _____________________ c. After the PROC CONTENTS step, add a PROC PRINT to display the data portion of work.newpacks to match what is shown below and run it: Product_Name

Supplier_Name

Black/Black X-Large Bottlegreen/Black ... Sioux Men's Backpack 26 Litre.

Top Sports Top Sports Miller Trading Inc

Show the code you added and the output showing the first five observations. 7. Accessing a SAS Data Library a. Write and submit the appropriate LIBNAME statement to provide access to the pg1 libref. Call it “pg1”. Submit the libname statement. b. Check the log to confirm that the SAS data library was assigned. Submit this portion of the log. c. Add a PROC CONTENTS step to list all the SAS data sets in the pg1 library. Do not display the descriptor portions of the individual data sets. Submit the code and the output. d. Add another PROC CONTENTS step to display the descriptor portion of the data set pg1.sales. Submit the output....


Similar Free PDFs