* SIMPLE LINEAR REGRESSION ; * 1. Here is how to read in data from an Excel file. Please make * sure that the Excel file from which you want to read in data * is not actually open at the time you are attempting to read in * data, as this is known to cause problems. ; PROC IMPORT DATAFILE = 'U:\STA580F08\Hypertension.xls' OUT = Hyper DBMS = EXCEL REPLACE; SHEET = Sheet1; GETNAMES = YES; RUN; * 2. You may want to verify that the data have been * read in successfully. In particular, if the names of your variables * in Excel have characters that are illegal for names in SAS, SAS may * change these characters to underscores. ; PROC PRINT DATA = Hyper; RUN; * 3. Here is how to fit a simple linear regression model. You can remove the * ODS PDF FILE, ODS PDF CLOSE, and final RUN statements if you do not wish to save * the output to a PDF file. If you do wish to save the output to a PDF file, make * sure to change 'U:\STA580F08\SLRExample.pdf' to reflect where you want * the output saved. ; ODS PDF FILE = 'U:\STA580F08\SLRExample.pdf'; PROC REG DATA = Hyper; MODEL SBP = AGE / clm cli ALPHA = 0.05 ; PLOT SBP * AGE; RUN; ODS PDF CLOSE; RUN;