Online File

How to use this page


Rick Aster: Professional SAS Programming Shortcuts: Contents

Chapter 9
Program
Demonstrations of numeric truncation


*
  Differences due to truncation
*;

data compare;
   length x8 8 x6 6;
   retain x8 x6 0.1;
run;
data _null_;
   set compare;
   put x8= x6=;
   if x8 = x6 then put 'Equal';
   else put 'Unequal';
run;

*
  TRUNC function
*;

data compare;
   length x8 8 x6 6;
   retain x8 x6 0.1;
run;
data _null_;
   set compare;
   put x8= x6=;
   if trunc(x8, 6) = x6 then put 'Equal';
   else put 'Unequal';
run;

*
  Visible differences from truncation
*;

data compare;
   length x8 8 x4 4;
   retain x8 x4 0.1;
run;
data _null_;
   set compare;
   put x8= x4=;
   if trunc(x8, 4) = x4 then put 'Equal';
   else put 'Unequal';
run;

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech | Dictionary

Download | Rastinate

Rick Aster

Professional SAS Programming Shortcuts

Contents/Online Files

Corrections

Catalog Page