Use of INFILE
and
Working with Dates in SAS
STAT 342 – Fall 2020 Tutorial – 5
Objectives
1. Read a text file with missing values and special characters
2. Use of Missing function to impute missing data
3. Use of MDY function to return a SAS date value
4. Count number of days, months and years between two dates
5. Use of PUT function
STOPOVER and MISSOVER when reading text file with missing values and special characters
STOPOVER: stops printing data when a data row do not contain data for all variables
MISSOVER: skips data rows that do not contain data for all variables and prints the rest of the data
Use of Missing function to impute missing data and Create a new variable with MDY function
• missing(): returns a 0/1 output indicating whether the observation is missing or not
• mdy(): returns a SAS date value from month, day, and year values
Count number of days, months and years
between two dates
• Intck(): returns the number of time units between two dates. For the time unit, you can choose years, months, weeks, days, and more
PUT function
• put(source, format): returns a value using a specified format.