Q: (Exporting results from SAS) I have produced results in SAS, which I would like to paste into a spreadsheet for formatting. Do I really have to paste the numbers, one by one, from the SAS output window?

A: Not any more! Instead, use the Output Delivery System (ODS) to put your results into a SAS data set. Then use the EXPORT procedure to put the SAS data set into an Excel spreadsheet file.

  1. Every part of the SAS output has a Name recognized by the Output Delivery System. Suppose you are running PROC REG. To see the ODS names for the output, use the ODS TRACE command before running your model.
    ODS TRACE ON / LISTING; /* Display ODS names in the output window. */
     PROC REG;
      MODEL y = x1 x2 etc;
     RUN;
    ODS TRACE OFF; /* Stop displaying ODS names (optional). */
    

    In the SAS output window, you'll see a Name above each part of the output. For the REG procedure, the first part of the output is named ANOVA, the second part is named FitStatistics, the third part is named ParameterEstimates.

  2. You can save each part of the output to a SAS file, as follows:

     PROC REG;
      MODEL y = x1 x2 etc;
      ODS OUTPUT ParameterEstimates=parms_out ANOVA=anova_out FitStatistics=r2s_out;
      /*
         ...or if you just want one part of the output, you can say, for example,
            ODS OUTPUT ParameterEstimates=parms_out;
      */
     RUN;
    

    The names parms_out etc are just examples. You can give these output data sets any names you want.

    Now your parameter estimates, for example, are in a SAS file. To see the file contents, type

     PROC PRINT DATA=parms_out;
     RUN;
    
  3. Finally, to export the parameter estimates to an Excel file, using the EXPORT procedure:
     PROC EXPORT DATA=parms_out REPLACE OUTFILE="x:\your_directory\choose_a_file_name.XLS";
     RUN;
    

    Again, the name and location of the Excel file are up to you, as long as you use the .XLS extension.

Now open the Excel file and format it. You may want to use my Excel command for adding asterisks to significant results.