Online File

How to use this page


Rick Aster: Professional SAS Programming Shortcuts: Contents

Chapter 11
Program
Reading signed numerals


*
  Embedded spaces
*;

DATA _NULL_;
   INFILE CARDS;
   INPUT FIELD $CHAR6.;
   FIELD  = COMPRESS(FIELD);
   VALUE = INPUT(FIELD, F6.);
   PUT VALUE;
DATALINES;
+    1
-  200
;

*
  Sign as separate fixed field
*;

DATA _NULL_;
   INFILE CARDS;
   INPUT SIGN $CHAR1. VALUE F5.;
   IF SIGN = '-' THEN VALUE = -VALUE;
   PUT VALUE;
DATALINES;
+    1
-  200
;

*
  Trailing sign
*;

DATA _NULL_;
   INFILE CARDS;
   INPUT FIELD $CHAR8.;
   IF SUBSTR(FIELD, 8) = '-' THEN VALUE = -INPUT(FIELD, F7.);
   ELSE VALUE = INPUT(FIELD, F8.);
   PUT VALUE;
DATALINES;
       0
     24-
   5.00-
;

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech | Dictionary

Download | Rastinate

Rick Aster

Professional SAS Programming Shortcuts

Contents/Online Files

Corrections

Catalog Page