Fundamentals of Programming in SAS. James Blum

Чтение книги онлайн.

Читать онлайн книгу Fundamentals of Programming in SAS - James Blum страница 14

Автор:
Жанр:
Серия:
Издательство:
Fundamentals of Programming in SAS - James Blum

Скачать книгу

statements can be included inside DATA or PROC steps.

      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
MortgageStatusN ObsNMeanStd DevMinimumMaximum
N/A30334230334237180.5939475.13-19998.001070000.00
No, owned free and clear30034930034953569.0863690.40-22298.001739770.00
Yes, contract to purchase9756975651068.5046069.11-7599.00834000.00
Yes, mortgaged/ deed of trust or similar debt54561554561584203.7072997.92-29997.001407000.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.1 Learning Objectives

       2.2 Case Study Activity

       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 User-Defined Formats

       2.5.1 The FORMAT Procedure

       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 Reading Raw Data

       2.8.1 Introduction to Reading Delimited Files

       2.8.2 More with List Input

       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

       2.9.3 Debugging the DATA

Скачать книгу