Online File

How to use this page


Rick Aster: Professional SAS Programming Shortcuts: Contents

Chapter 55
Program
Calendar pseudo-array lookup


data history.trans;
   * Load calendar data from calendar dataset. ;
   length openstr $ 370;
   retain cal_base openstr;
   if _n_ = 1 then do;
      cal_base = mdy(1, 1, year) - 1;
      do date = mdy(1, 1, year) to mdy(12, 31, year);
         set corp.calendar key=date/unique;
         substr(openstr, date - cal_base, 1) = openday;
         end;
      end;
   * Check transaction dates. ;
   modify history.trans;
   if cal_base < date < cal_base + 370;
   * Find a transaction recorded on a closed day. ;
   if substr(openstr, date - cal_base, 1) = '0';
   * Change date to next open day. ;
   do until (substr(openstr, date - cal_base, 1) = '1');
      date + 1;
      if date >= cal_base + 370 then leave;
      end;
    replace;
run;

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech | Dictionary

Download | Rastinate

Rick Aster

Professional SAS Programming Shortcuts

Contents/Online Files

Corrections

Catalog Page