Homework 1 instructions

pdf

School

Purdue University *

*We aren’t endorsed by this school

Course

506

Subject

Statistics

Date

Feb 20, 2024

Type

pdf

Pages

2

Uploaded by BailiffKangaroo6144

Report
STAT 506: Homework 1 You should first download the Data folder for the Programming 1 course from Brightspace; it is available in a zip file called “PG1.zip.” You will need to unzip it and follow the instructions on running the cre8data.sas program. 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. 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 / Snip & Sketch app in Windows or Shift-Command-4 on a Mac) and 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. Be aware that this first assignment is shorter than future assignments will be. Use this as a “warm up.” Take the extra time to play around a bit and familiarize yourself with SAS, after making sure you’re comfortable with how you’ll be accessing it this semester (downloaded on PC, using Purdue labs, online OnDemand for Academics, and/or Software Remote). 1. Submitting a Program data hw1; set sashelp.cars; run; proc print data=hw1 noobs; var Make Model MPG_Highway; where MPG_Highway > 39; run; a. How many steps are in the above code? How many statements are in the above code? b. Copy the above code into the Editor window. Submit the program for execution. How many rows and columns are in the report (excluding the variable name row) in the Results Viewer window? c. Examine the Log window. Based on the log notes following the DATA step, how many observations and variables are in the sashelp.cars table? 2. Diagnosing and Correcting Syntax Errors proc prnt data=sashelp.cars; var EngineSize hoRsepoWeR /* This line is a comment and we don't want it to run; RUN; a. The above SAS code might have some errors. State the error(s). b. Correct the error(s) and submit the program. Show the final code and the output showing the first five observations. 3. Understanding SAS Dates a. The Justice League of America debuted in comics on December 29, 1959. What is that as a SAS date? b. When stored in a variable as a SAS date, what would its default length (byte size) be?
4. Examining the Descriptor Portion of a SAS Table a. Write a PROC CONTENTS step to display the descriptor portion of the sashelp.Holiday table . Show your code. b. Submit the program and answer the following questions: How many observations (rows) are in the data set? How many variables (columns) are in the data set? What is the length (byte size) of the variable desc ? 5. Accessing a SAS Data Library a. Write and submit the appropriate LIBNAME statement to provide access to the pg1/data folder. Call the libref “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 display the descriptor portion of the table pg1.storm_range . Submit the code and the output. (Yes, there will be a lot of output.) 6. Using PROC IMPORT for CSV Files a. Download the file hw1data.csv from Brightspace. You will want to take note of the location of the downloaded file. If you’re working with SAS OnDemand or Software Remote, you’ll have to then upload it to the remote environment. Write a PROC IMPORT step to read into SAS as a table named work.hw1data . Submit the code. b. The PROC IMPORT you just ran created a new file named hw1data.sas7bdat on your system. After you end your SAS session (don’t do that right now), what will happen to that file and why? c. Then run the below code. Submit a screenshot of the output. proc print data=work.hw1data; run;
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help