/* The sas commands for part 2 of the SAS tutorial */ /* Computing a new variable */ /* Make sure you associate the sasdir library with the c:\temp area*/ LIBNAME sasdir "c:\temp" ; DATA sasdir.banknew ; set sasdir.bankend1 ; y = year (bdate) ; age = 2002 - y ; PROC FREQ ; TABLES age ; RUN ; /* Adding a value label */ PROC FORMAT ; Value degree 1="no HS" 2="no BA" 3="BA or more" ; PROC FREQ ; FORMAT educ2 degree. ; TABLES educ2 ; RUN ; /* Controlling output */ OPTIONS NOCENTER FORMDLIM = "~" ; /* A t-test with titles */ PROC TTEST ; CLASS gender ; VAR salary ; TITLE 'Descriptive statistics listed separately for each gender' ; RUN ; /* Create a plot of salary vs educ by gender */ PROC PLOT ; PLOT salary * educ = gender ; TITLE2 'Plot of Salary by Education by Gender' ; /* Create a plot of salary vs jobtime by gender */ PLOT salary * jobtime = gender ; TITLE2 'Plot of Salary by Time on the Job by Gender' ; RUN ; /* Create a plot of salary vs age by gender */ PROC PLOT ; PLOT salary * age = gender ; TITLE2 'Plot of Salary by Age by Gender' ; RUN ; /* Simple Linear Regression */ PROC SORT DATA=sasdir.banknew ; BY gender ; PROC REG DATA=sasdir.banknew ; MODEL salary = educ jobtime preexp age; BY gender ; RUN ; /* Printing just certain variables using double-dash variable list */ PROC PRINT ; VAR id salary--minority; RUN;