Part 1: Access and Create Data Structures
Lecture-1 SAS Programs
· Introduction to SAS programs
· Submitting a SAS program
· Working with SAS program syntax
· Practical Exercise
Lecture-2 Create temporary and permanent SAS data sets.
· Use a DATA step to create a SAS data set from an existing SAS data set.
· Example: Data Mylib.NewData;
Set Mylib.OldData;
<other SAS statements>
Run;
Lecture-3 Investigate SAS data libraries using base SAS utility procedures.
· Use a LIBNAME statement to assign a library reference name to a SAS library.
· Investigate a library programmatically using the CONTENTS procedure.
· Practical Exercise
Lecture-4 Combine SAS data sets.
· Concatenate data sets.
· Merge data sets one-to-one.
· Merge data sets one-to-many.
· Practical Exercise
Lecture-5 Access an Excel workbook.
· Use the SAS/ACCESS XLSX engine to read an .xlsx file.
· Practical Exercise
Lecture-6 Create and manipulate SAS date values.
· Explain how SAS stores date and time values.
· Use SAS date and time formats to specify how the values are displayed.
· Practical Exercise
Lecture-7 Export data to create standard and comma-delimited raw data files.
· Create a simple raw data file by using the EXPORT procedure as an alternative to the DATA step.
· Practical Exercise
Lecture-8 Control which observations and variables in a SAS data set are processed and output.
· Use the WHERE statement in the DATA step to select observations to be processed.
· Subset variables to be output by using the DROP and KEEP statements.
· Use the DROP= and KEEP= data set options to specify columns to be processed and/or output.
· Practical Exercise
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
Part 3: Generate Reports
Lecture-18 Generate list reports using the PRINT procedure.
· Modify the default behavior of PROC PRINT by adding statements and options such as
· Use the VAR statement to select and order variables.
· Calculate totals with a SUM statement.
· Select observations with a WHERE statement.
· Use the ID statement to identify observations.
· Use the BY statement to process groups.
· Practical Exercise
Lecture-19 Generate summary reports and frequency tables using base SAS procedures.
· Produce one-way and two-way frequency tables with the FREQ procedure.
· Enhance frequency tables with options.
· Use PROC FREQ to validate data in a SAS data set.
· Calculate summary statistics and multilevel summaries using the MEANS procedure
· Enhance summary tables with options.
· Identify extreme and missing values with the UNIVARIATE procedure.
· Practical Exercise
Lecture-20 Enhance reports through the use of user-defined formats, titles, footnotes and SAS System reporting.
· Use the LABEL statement to define descriptive column headings.
· Control the use of column headings with the LABEL and SPLIT=options in Proc Print output.
· Practical Exercise
Lecture-21 Generate reports using ODS statements.
· Identify the Output Delivery System destinations.
· Create HTML, PDF, RTF, and files with ODS statements.
· Use the STYLE=option to specify a style template.
· Create files that can be viewed in Microsoft Excel.
· Practical Exercise
Part 4: Error Handling
Lecture-22 Identify and resolve programming logic errors.
· Use the PUTLOG Statement in the Data Step to help identify logic errors.
· Use PUTLOG to write the value of a variable, formatted values, or to write values of all variables.
· Use PUTLOG with Conditional logic.
· Use temporary variables N and ERROR to debug a DATA step.
· Practical Exercise
Lecture-23 Recognize and correct syntax errors.
· Identify the characteristics of SAS statements.
· Define SAS syntax rules including the typical types of syntax errors such as misspelled keywords, unmatched quotation marks, missing semicolons, and invalid options.
· Use the log to help diagnose syntax errors in a given program.
· Practical Exercise
Lecture-24 Examine and resolve data errors.
· Given a SAS program, use the log to determine the reason for a data error.
· Practical Exercise
Case Studies