The only way to really learn the application of SAS and statistical analysis applications for research problems is to work through examples and scenarios. Below are some examples of very simple SAS programs that you can use to practice with SAS. We recommend making notes about each line and section of the code to help you understand what is happening. Try to focus on explaining each command in your own terms, the importance of the section, and what you are telling SAS to do. Print the output that you generate and explain what you have produced.

SAMPLE PROGRAM 1. OPTIONS PAGESIZE=65 LINESIZE=72 CENTER DATE; DATA EXAMPLE1; INPUT ID 1-2 RHR 4-5 ; DATALINES; 01 73 02 88 03 90 04 69 05 72 06 77 07 86 08 84 09 72 10 67 11 62 12 74 13 83 14 78 15 72 16 87 17 66 ; TITLE 'A PRACTICE EXAMPLE TO PRODUCE THE MEAN FOR RESTING HEART RATE'; PROC SORT DATA=EXAMPLE1; BY ID; PROC UNIVARIATE; VAR RHR; RUN;

SAMPLE PROGRAM 2. OPTIONS PAGESIZE=65 LINESIZE=72 CENTER DATE; DATA EXAMPLE2; INPUT ID 1-3 GROUP 5-6 AGES 8-9; DATALINES; 001 01 78 002 01 87 003 01 81 004 01 82 005 01 79 006 02 65 007 02 64 008 02 63 009 02 61 010 02 67 011 03 56 012 03 89 013 03 90 014 03 59 015 03 66 016 02 85 017 02 74 018 02 73 019 02 81 020 02 97 ; PROC SORT DATA=EXAMPLE2; BY GROUP; PROC PRINT; VAR ID GROUP AGES; TITLE 'PRINTOUT OF AGES IN THREE GROUPS'; TITLE 'INCLUDE YOUR NAME AND COURSE TITLE HERE'; RUN; PROC UNIVARIATE; VAR AGES; TITLE ‘DESCRIPTIVE STATISTICS FOR THE TOTAL GROUP’; RUN; PROC UNIVARIATE; VAR AGES; BY GROUP; TITLE 'DESCRIPTIVE STATISTICS BY GROUP'; FOOTNOTE 'THIS OUTPUT CREATED BY YOUR_NAME_HERE '; RUN;

SAMPLE PROGRAM 3. OPTIONS PAGESIZE=65 LINESIZE=72 CENTER DATE; DATA EXAMPLE3; INPUT ID 1-3 SEX \$ 5 KIDSAGE 7-8; DATALINES; 001 F 08 002 M 09 003 F 11 004 M 02 005 F 06 006 F 06 007 M 07 008 F 08 009 M 09 010 F 11 011 F 08 012 M 07 013 M 10 014 M 02 015 F 03 016 F 02 017 M 07 018 F 08 019 M 09 020 F 10 ; RUN; TITLE1 "THE COOLEST PROGRAM I HAVE EVER WRITTEN!"; PROC SORT DATA=EXAMPLE3; BY SEX; PROC PRINT; VAR ID SEX KIDSAGE; PROC MEANS; VAR KIDSAGE; PROC UNIVARIATE; VAR KIDSAGE; BY SEX; PROC FREQ; TABLES SEX; RUN;