Online File

How to use this page


Rick Aster: Professional SAS Programming Logic: Contents

Chapter 2
Program
Basketball Variation: Creating Multiple SAS Datasets


OPTIONS LINESIZE=75 NOCENTER PAGENO=1;
TITLE1 'Basketball Scorers';

DATA  CENTER.TOPFG (KEEP=TEAM PLAYER FG)
      CENTER.TOPP3 (KEEP=TEAM PLAYER P3)
      CENTER.TOPFT (KEEP=TEAM PLAYER FT)
      CENTER.TOPPTS (KEEP=TEAM PLAYER PTS)
      ;
   INFILE BASKET TRUNCOVER;
   INPUT
       TEAM $18.
       PLAYER $20.
       FG 4.
       P3 4.
       FT 4.
       ;

   *
      Convert missing values to zeroes.
   *;
   IF FG = . THEN FG = 0;
   IF P3 = . THEN P3 = 0;
   IF FT = . THEN FT = 0;

   *
      Calculate points and field goals.
   *;
   P2 = FG - P3;
   PTS = 2*P2 + 3*P3 + FT;
   FG = P2 + P3;

   *
      Keep only players at or above a certain cutoff
      in each category.
   *;
   IF FG >= 100 THEN OUTPUT CENTER.TOPFG;
   IF P3 >= 30 THEN OUTPUT CENTER.TOPP3;
   IF FT >= 50 THEN OUTPUT CENTER.TOPFT;
   IF PTS >= 250 THEN OUTPUT CENTER.TOPPTS;
RUN;

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech

Download | Rastinate

Rick Aster

Professional SAS Programming Logic

Contents/Online Files

Corrections

Catalog Page