In this module you will learn how to transform date values using a variety of useful date functions, including:
TODAY, DATE, MDY, DAY, MONTH, YEAR, WEEKDAY, QTR, TIME / DATETIME, TIMEPART / DATEPART, INTCK / INTNX, YRDIF / DATDIF
Each function is introduced in standard syntax form, illustrating both the required arguments and any optional arguments which are available with an explanation of their purpose.
This is followed by an example of each function in action using data from a simple dataset.
There are also mini quizzes and comprehensive exercises throughout to help assess and reinforce your learning.
Learning Outcome
By the end of this module you will be able to describe how functions are used to perform date transformation.
Pre-requisites
This module is aimed at those who are new to the Language of SAS.
You should already have:
For the hands-on practice activities in the module, you will need access to an environment that runs the programming Language of SAS. On our courses, we signpost you to some of the free tools available.
Check out the links below to review system requirements:
Reference Modules
The following reference modules are included to support your learning:
Introduction to SAS Programming
Learning Objective: Explain what the Language of SAS is used for and by whom.
Explanation about SAS and who uses it
Data Access Data Management Data Analysis Data Presentation
Basic Concepts
Learning Objective: Explain how the Language of SAS is used to access, manage, analyse and present data.
- What is a dataset, a database and a relational database?
- Libraries, LIBREFS, LIBNAME statement
- Referencing a dataset
- The Data Step procedure
- Basic Procedures including PROC MEANS and PROC PRINT
Investigating SAS datasets
Learning Objective: Define how to investigate datasets in the Language of SAS using two types of Procedure.
- The PRINT procedure
- Metadata, the CONTENTS procedure
- Types of data
Programming Concepts
Learning Objective: Describe the key programming concepts within the Language of SAS.
- Program components – Data Steps and Procedures
- Programming language is made up of statements, expressions, functions & call routines, options, formats, and informats
- Managing Syntax errors
- Naming conventions
Data Step Processing
Learning Objective: Explain how the two phases of Data Step Processing work to create new datasets and variables.
- Data Step syntax: The DATA and SET Statements
- Creating Datasets
- Creating Variables
- Data Step processing, i.e. what goes on in the background when you submit your data step code.
Selecting Variables and Observations
Learning Objective: Define Variables and Observations to be read from and written to datasets.
- KEEPing and DROPing Variables
- The IF Statement
- The WHERE Statement
- FIRSTOBS= and OBS=
- IS NULL or IS MISSING
- BETWEEN-AND
- CONTAINS (?) and SOUNDS LIKE (=*)