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.

First, we run some code using "engine='sas'" without saving the intermediate SAS files. Not shown here, this code chunk has label "procmeans0".

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

                        Analysis Variable : Height 
 
     N            Mean         Std Dev         Minimum         Maximum
    ------------------------------------------------------------------
    19      62.3368421       5.1270752      51.3000000      72.0000000
    ------------------------------------------------------------------

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

```{r procmeans1, engine='sas', 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?.*")