SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Search||next

Reading Date and Time Values
Lesson Overview


Introduction

SAS software provides many SAS informats for reading raw data values in various forms. If you took the lesson Reading Raw Data in Fixed Fields, you worked with informats to read standard and nonstandard data. In this lesson, you learn how to use a special category of SAS informats called date and time informats. These informats enable you to read a variety of common date and time expressions. After you read date and time values, you can also perform calculations with them.

     options yearcutoff=1920;
     data perm.aprbills;
        infile aprdata;
        input LastName $8. @10 DateIn mmddyy8. +1 DateOut
           mmddyy8. +1 RoomRate 6. @35 EquipCost 6.;
        Days=dateout-datein+1;
        RoomCharge=days*roomrate;
        Total=roomcharge+equipcost;
     run;

Program Data Vector

This lesson contains 31 pages and takes approximately 45-60 minutes to complete.


Objectives

In this lesson, you will learn

  • how SAS software stores date and time values
  • to read common date and time expressions using SAS informats
  • how to handle two-digit date values
  • to calculate time intervals by subtracting two dates
  • to multiply a time interval by a rate.


Prerequisites

Before taking this lesson, you should have completed the following lessons:

Introduction to SAS Programming

Creating SAS Data Sets

Reading Various Types of Raw Data


||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement