1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;5556 /* hungrymice.sas */57 title 'Calorie restriction and Longevity in Mice';5859 /* Read data directly from Excel spreadsheet */60 proc import datafile="/folders/myfolders/2453f15/StarvingMice.XLS"61 out=mouse1 dbms=xls replace;62 getnames=yes;63 /* Input data file is StarvingMice.XLS64 Ouput data table is called mouse165 dbms=xls The input file is an Excel spreadsheet.66 Necessary to read an Excel spreadsheet directly under unix/linux67 Works in PC environment too except for Excel 4.0 spreadsheets68 Import of xlsx in Version 9.3 is buggy or I am doing something wrong. SAS Version 9.269 If there are multiple sheets, use sheet="sheet1" or something.70 replaceIf the data table out1 already exists, replace it.71 getnames=yes Use column names as variable names. */7273 /* proc print; */7475 run;NOTE: The import data set has 349 observations and 2 variables.NOTE: WORK.MOUSE1 data set was successfully created.NOTE: PROCEDURE IMPORT used (Total process time):real time 0.04 secondscpu time 0.04 seconds7677 proc freq;78 tables diet;79NOTE: There were 349 observations read from the data set WORK.MOUSE1.NOTE: PROCEDURE FREQ used (Total process time):real time 0.13 secondscpu time 0.12 seconds80 proc means;81 class diet;82 var lifetime;83NOTE: There were 349 observations read from the data set WORK.MOUSE1.NOTE: PROCEDURE MEANS used (Total process time):real time 0.07 secondscpu time 0.07 seconds84 data mouse2;85 set mouse1; /* Now mouse2 is just mouse1, and we can86 transform the data. */87 diet0 = diet;88 if diet = 'NP' then diet = 'Feed at Will';89 else if diet = 'lopro' then diet = 'N/R50 lopro';90 label lifetime = 'Life Length in Months';9192 /* By default, procedures use the most recently created SAS data table.93 If you don't want this, use the data= option. */94NOTE: There were 349 observations read from the data set WORK.MOUSE1.NOTE: The data set WORK.MOUSE2 has 349 observations and 3 variables.NOTE: DATA statement used (Total process time):real time 0.06 secondscpu time 0.04 seconds95 proc freq;96 title2 'Check Re-labeling of Diet';97 tables diet * diet0 / norow nocol nopercent;98NOTE: There were 349 observations read from the data set WORK.MOUSE2.NOTE: PROCEDURE FREQ used (Total process time):real time 0.09 secondscpu time 0.08 seconds99 proc glm;100 title2 'Main analysis';101 class diet;102 model lifetime=diet / clparm; /* clparm gives CIs for contrasts down in103 the estimate statements. */104 means diet;105 /* Estimate (like Contrast) uses alphabetical order: Be careful!106 Feed at Will | N/N85 | N/R40 | N/R50 | N/R50 lopro | R/R50107 Positive values of contrast mean longer life with less food. */108 estimate 'Feed at Will vs. N/N85' diet -1 1 0 0 0 0;109 estimate 'N/N85 vs. N/R50' diet 0 -1 0 1 0 0;110 estimate 'N/R50 vs. R/R50' diet 0 0 0 -1 0 1;111 estimate 'N/R40 vs. N/R50' diet 0 0 1 -1 0 0;112 estimate 'N/R50 vs. N/R50 lopro' diet 0 0 0 1 -1 0;113114115116 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;128