Fundamentals of Programming in SAS. James Blum
Чтение книги онлайн.
Читать онлайн книгу Fundamentals of Programming in SAS - James Blum страница 14
![Fundamentals of Programming in SAS - James Blum Fundamentals of Programming in SAS - James Blum](/cover_pre687444.jpg)
5. Consider the program below.
options date label;
title ‘Superhero Profile: Jennie Blockhus’;
proc print data = superheroes label;
where homeTown eq ‘Redmond’ and current = ‘Themyscira’;
var Alias Powers FirstIssue Superfriend Nemesis;
run;
options nonumber nolabel;
proc freq data = superheroes;
where homeTown eq “Redmond” and current = “Themyscira”;
table sightings*state;
run;
a. Determine the number of global statements.
b. Determine the number of steps.
c. What distinguishes global statements from other statements in the above program?
d. Is it a syntax error to enclose literals in both single and double quotation marks as done in the above program? Why or why not?
Programming Basics
1. Complete the following steps, in either the SAS windowing environment or SAS University Edition:
a. Open Program 1.8.1 (shown below).
b. Download the data for the textbook and assign a library to its location.
c. Replace the comment with the library reference established in part (b).
d. Submit the code.
e. If the submission does not execute successfully, check the log and output for errors in the library assignment and/or reference.
f. Repeat the above steps as necessary until the code executes properly.
Program 1.8.1: Sample Program for Submission
proc means data=/*put library reference here*/.IPUMS2005Basic;
class MortgageStatus;
var HHIncome;
run;
Output 1.8.1: Expected Result from Program 1.8.1 (Colors and Fonts May Differ)
Analysis Variable : HHINCOME Total household income | ||||||
MortgageStatus | N Obs | N | Mean | Std Dev | Minimum | Maximum |
N/A | 303342 | 303342 | 37180.59 | 39475.13 | -19998.00 | 1070000.00 |
No, owned free and clear | 300349 | 300349 | 53569.08 | 63690.40 | -22298.00 | 1739770.00 |
Yes, contract to purchase | 9756 | 9756 | 51068.50 | 46069.11 | -7599.00 | 834000.00 |
Yes, mortgaged/ deed of trust or similar debt | 545615 | 545615 | 84203.70 | 72997.92 | -29997.00 | 1407000.00 |
Case Study
For additional practice, multiple case studies are available in addition to the IPUMS CPS case study used in subsequent chapters. See Section 8.1 to apply the skills from this chapter to the Clinical Trials Case Study. For additional case studies, including extensions to the IPUMS CPS case study, see the author pages.
Chapter 2: Foundations for Analyzing Data and Reading Data from Other Sources
2.3 Getting Started with Data Exploration in SAS
2.3.1 Assigning Labels and Using SAS Formats
2.3.2 PROC SORT and BY-Group Processing
2.4 Using the MEANS Procedure for Quantitative Summaries
2.4.1 Choosing Analysis Variables and Statistics in PROC MEANS
2.4.2 Using the CLASS Statement in PROC MEANS
2.5.2 Permanent Storage and Inspection of Defined Formats
2.6 Subsetting with the WHERE Statement
2.7 Using the FREQ Procedure for Categorical Summaries
2.7.1 Choosing Analysis Variables in PROC FREQ
2.7.2 Multi-Way Tables in PROC FREQ
2.8.1 Introduction to Reading Delimited Files
2.8.3 Introduction to Reading Fixed-Position Data
2.9 Details of the DATA Step Process
2.9.1 Introduction to the Compilation and Execution Phases
2.9.2 Building blocks of a Data Set: Input Buffers and Program Data Vectors