Part 2: Manage Data
· Lecture-9 Sort observations in a SAS data set.
· Use the SORT Procedure to re-order observations in place or output to a new dataset.
· Practical Exercise
· Lecture-10 Conditionally execute SAS statements.
· Use IF-THEN/ELSE statements to process data conditionally.
· Use DO and END statements to execute multiple statements conditionally.
· Practical Exercise
· Lecture-11 Use assignment statements in the DATA step.
· Create new variables and assign a value.
· Assign a new value to an existing variable.
· Assign the value of an expression to a variable.
· Assign a constant date value to a variable.
· Practical Exercise
· Lecture-12 Modify variable attributes using options and statements in the DATA step.
· Change the names of variables by using the RENAME= data set option.
· Use LABEL and FORMAT statements to modify attributes in a DATA step.
· Define the length of a variable using the LENGTH statement.
· Practical Exercise
· Lecture-13 Accumulate sub-totals and totals using DATA step statements.
· Use the BY statement to aggregate by subgroups.
· Practical Exercise
· Lecture-14 Use SAS functions to manipulate character data, numeric data, and SAS date values.
· Use SAS functions such as SCAN, SUBSTR, TRIM, UPCASE, and LOWCASE to perform tasks such as the tasks shown below.
· Replace the contents of a character value.
· Trim trailing blanks from a character value.
· Search a character value and extract a portion of the value.
· Convert a character value to upper or lowercase.
· Use SAS arithmetic, financial, and probability functions to create or modify numeric values by using the INT and ROUND functions.
· Create SAS date values by using the functions MDY, TODAY,DATE, and TIME.
· Extract the month, year, and interval from a SAS date value by using the functions YEAR, QTR, MONTH, and DAY.
· Perform calculations with date and datetime values and time intervals by using the functions INTCK, INTNX, DATDIF and YRDIF.
· Practical Exercise
· Lecture-15 Use SAS functions to convert character data to numeric and vice versa.
· Explain the automatic conversion that SAS uses to convert values between data types.
· Use the INPUT function to explicitly convert character data values to numeric values.
· Practical Exercise
· Lecture-16 Process data using DO LOOPS.
· Explain how iterative DO loops function.
· Use DO loops to eliminate redundant code and to perform repetitive calculations.
· Use conditional DO loops.
· Use nested DO loops.
· Practical Exercise
· Lecture-17 Validate and clean data.
· Use PROC FREQ to list unique values, with the nlevel option to show the number of distinct values, with the order=freq to check for duplicate or missing values.
· Use PROC PRINT with the WHERE statement to display observations with invalid values.
· Use PROC MEAN to validate the range of numeric variables.
· Use PROC UNIVARIATE to display extreme observations and missing values and with the ID statement to display the value of identifying variable
· Practical Exercise