Copy of SAS Programming Module Eleven Lesson One Activity

.pdf

School

North Carolina State University *

*We aren’t endorsed by this school

Course

15

Subject

Statistics

Date

Nov 24, 2024

Type

pdf

Pages

4

Uploaded by GrandGalaxyDolphin7

Google File Access Directions: Please click on File in the upper left corner. If you are working on a Chromebook or Google Docs, choose the Make a copy option and save a copy of the document to your Google Drive. If not, choose the Download as option and then the Microsoft Word (.docx) option to download an editable copy of the document to your computer. Module Eleven Lesson One Activity Open p204a01.sas from the activities folder and perform the following tasks: 1. Add a FORMAT statement in the DATA step to format the following values: Date Use MONYY7. to display three-letter month and four-digit year values. Volume Use COMMA12. to add commas. CloseOpenDff HighLowDiff Use DOLLAR8.2 to add dollar signs and include two decimal places. 2. Run the program and verify the formatted values in the PROC PRINT output. 3. Add a FORMAT statement in the PROC MEANS step to format the values of Date to show only a four-digit year. Run the PROC MEANS step again. 4. What is the advantage of adding a FORMAT statement to the DATA step versus the PROC step? The advantage of adding a FORMAT statement to the DATA step versus the PROC step is if you would want the entire dataset to be formatted the same. The format will not need to be reapplied each time. %let path=~/EPG294/data; libname PG2 "&path"; data work.stocks; set pg2.stocks; CloseOpenDiff=Close-Open; HighLowDiff=High-Low; format Date monyy7. Volume comma12. CloseOpenDiff HighLowDiff dollar8.2; run;
proc print data=stocks (obs=5); var Stock Date Volume CloseOpenDiff HighLowDiff; run; proc means data=stocks maxdec=0 nonobs mean min max; class Stock Date; var Open; format Date year4.; run; Open p204a02.sas from the activities folder and perform the following tasks: 1. In the PROC FORMAT step, modify the second VALUE statement to create a format named HRANGE that has the following criteria: A range of 50 – 57 has a formatted value of Below Average . A range of 58 – 60 has a formatted value of Average . A range of 61 – 70 has a formatted value of Above Average . 2. In the PROC PRINT step, modify the FORMAT statement to format Height with the HRANGE format. 3. Run the program and verify the formatted values in the PRINT output. 4. Why is the Height value for the first row not formatted? The Height value for the first row is not formatted because it does not fall within the specified ranges of the HRANGE format. %let path=~/EPG294/data; libname PG2 "&path"; proc format; value $genfmt 'F'='Female' 'M'='Male';
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