Author: Doug Hemken

# Saving Intermediate SAS files

#### Doug Hemken

#### Aug 2022

You may want to save the intermediate SAS files. This works with all of the SAS engines.

The file names are taken from the code chunk label.

If we invoke the `saveSAS=TRUE` option to save the intermediate SAS files:

    ```{sas procmeans1, saveSAS=TRUE, results="hide"}
    proc means data=sashelp.class(keep=height);
    run;
    ```

we will save three intermediate files: procmeans1.sas, procmeans1.log, and procmeans1.lst.

    proc means data=sashelp.class(keep=height);
    run;

If we stopped here you could see these in a file explorer. Here we'll show them with some R code.

    list.files(pattern="proc")

    [1] "procmeans1.log" "procmeans1.lst" "procmeans1.sas"

Then finally, for this example, we will delete them.

    unlink("procmeans?.*")