Reading the Data:
The first step is to save the data to a file by copying and pasting. Be sure to save it as a text file. Then open SAS and go to the"File" option on the menu bar. Then choose "Import" from the file menu. This opens the first "Import Wizard" window (shown below). Be sure that "Standard file format" is selected and the slot says "Delimited file (*.*)", and then click "Next".
Then you will have the "Select file" window (shown below).
Enter the file name of your data text file, by browsing or typing it in directly. Then click "Options..." This will open the "Delimited file Options" window (shown below)
Make sure the "Delimiter" is set for "Blank", and "Get variable names from first row" is selected. Also, "First row of data:" should be set for 2. Then click "OK" This will bring you back to the "Select File" window. Click "OK" there, too. This will open the final window, "Select library and member".
The slot for "LIBRARY" should have "WORK" by default. The slot for "MEMBER" will be blank. Here you type the name of the data set by clicking on the empty slot. We called the data set "pain". After typing in the name of the data set, click the "Finish" button. This will import your data set. To check and see if SAS read the file correctly, you can type the following program in the "Program Editor" window:
proc print; run;
To run any program written in the program window, go to the "Local" option on the menu bar and choose "Submit" from the pull down window.
proc sort; by active; proc univariate plot; var score1 score2 change; by active; run; * "proc univariate plot" gives: * moments or summary statistics, * normal probability plot, * stem and leaf plot, and * box plot. * NOTE: When Reading the normal probability plot; the "*" represents the reference line and * the "+" represents the data. See results Inferential statistics:
proc ttest; class active; var score1 score2 change; See results
proc glm data = pain; class active; model score1 score2 = active; * score1 and score2 are dependent variables, active is the independent variable repeat magnets 2; * Two levels of within subjects repeat measure, referred to as magnets. means active; See results
*** for computing the chi square, you need to enter the data in terms of counts: *** the first two columns of data refers to the categories, and the third column i *** is the count for that category data chd; input imp activ wt; cards; 1 1 22 1 2 4 2 1 7 2 2 17 ; PROC FREQ ORDER=DATA; WEGHT wt; tables imp*activ / chisq measures; * computes the chi square statistic title 'Ch-Square: Reporting Pain improvement by magnetic activity'; run; See results
proc glm; class active; model score2 = score1 active score1*active; means active; run; *the first procedure module performs ANCOVA, including the interaction term. *Score2 is the dependent variable, score1 is a covariate, and active is an independent variable * or a factor, since it is a grouping variable. proc glm; class active; model score2=score1 active; means active; run; * the second procedure is the same as above, but without the interaction. See results Note: To run each proc individually, you need a "run;" statement at the end of eahc proc.