1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 /* classicalpain.sas */
57 title "Pain data: Read from an Excel Spreadsheet";
58
59 proc import datafile="/folders/myfolders/Pain.xls"
60 out=ouch dbms=xls replace;
61 getnames=yes;
62 /* Input data file is Pain.xls
63 Ouput data table is called ouch
64 dbms=xls The input file is an Excel spreadsheet.
65 Necessary to read an Excel spreadsheet directly under unix/linux
66 Works in PC environment too except for Excel 4.0 spreadsheets
67 If there are multiple sheets, use sheet="sheet1" or something.
68 replaceIf the data table already exists, replace it. Use this!
69 getnames=yes Use column names as variable names. Beware of
70 leading and trailing blanks if it's in xlsx format. */
71
NOTE: The import data set has 10 observations and 7 variables.
NOTE: WORK.OUCH data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
72 proc print;
73
74 /* Convert to univariate format, with 6 "cases" per patient. */
75
NOTE: There were 10 observations read from the data set WORK.OUCH.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.04 seconds
cpu time 0.05 seconds
76 data arthritis;
77 set ouch;
78 Drug=1; Dose=1; Pain=Drug1Dose1; output;
79 Drug=1; Dose=2; Pain=Drug1Dose2; output;
80 Drug=1; Dose=3; Pain=Drug1Dose3; output;
81 Drug=2; Dose=1; Pain=Drug2Dose1; output;
82 Drug=2; Dose=2; Pain=Drug2Dose2; output;
83 Drug=2; Dose=3; Pain=Drug2Dose3; output;
84 keep Patient Drug Dose Pain;
85
NOTE: There were 10 observations read from the data set WORK.OUCH.
NOTE: The data set WORK.ARTHRITIS has 60 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
86 proc print;
87
NOTE: There were 60 observations read from the data set WORK.ARTHRITIS.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.08 seconds
cpu time 0.08 seconds
88 proc tabulate;
89 title2 'Look at the means';
90 class Drug Dose;
91 var Pain;
92 table (Drug all),(Dose all) * (mean*Pain);
93
NOTE: There were 60 observations read from the data set WORK.ARTHRITIS.
NOTE: PROCEDURE TABULATE used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
94 proc glm;
95 title2 'Classical mixed model repeated measures';
96 class Patient Drug Dose;
97 model Pain = patient Drug|Dose;
98 random Patient / test;
99
100
101 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
113