# Overview

    library(sasquatch)

## Session management

Every `sasquatch` script starts with `sas_connect()`. By default, you will be connected to your first SAS configuration (for more about configurations see `vignette("configuration")`).

    sas_connect()
    #> ✔ SAS connection established.

You can also specify your configuration by name:

    sas_connect(cfgname = "my_config", reconnect = TRUE)
    #> ✔ SAS connection terminated.
    #> ✔ SAS connection established.

If you ever need to end a connection, you can do so by using:

    sas_disconnect()
    #> ✔ SAS connection terminated.

All connection information is stored within a `saspy.sasbase.SASsession` object. For most individuals, you will never need to interact with this object, but if you would like to implement functionality not currently within `sasquatch` or would like to access the current session from Python, you can via:

    sas_get_session()
    #> Access Method         = IOM
    #> SAS Config name       = my_config
    #> SAS Config file       = /home/user/.virtualenvs/r-saspy/lib/python3.12/site-packages/saspy/sascfg_personal.py
    #> WORK Path             = /saswork/SAS_work0D3600010B4E_odaws01-usw2-2.oda.sas.com/SAS_work920700010B4E_odaws01-usw2-2.oda.sas.com/
    #> SAS Version           = 9.04.01M7P08062020
    #> SASPy Version         = 5.101.1
    #> Teach me SAS          = False
    #> Batch                 = False
    #> Results               = Pandas
    #> SAS Session Encoding  = utf-8
    #> Python Encoding value = utf-8
    #> SAS process Pid value = 68430
    #> SASsession started    = Wed Dec 25 13:58:22 2024

## Executing SAS code

You can execute SAS code in a variety of different ways. All `sas_run_*()` functions generate htmlwidgets, which display both the output and log.

To execute a string of SAS code use `sas_run_string()`.

    sas_run_string("PROC MEANS DATA = sashelp.cars;RUN;")

    #> $x
    #> $x$lst
    #> [1] "<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta charset=\"utf-8\"/>\n<meta content=\"SAS 9.4\" name=\"generator\"/>\n<title>SAS Output</title>\n<style>\n/*<![CDATA[*/\n.body.c > table, .body.c > pre, .body.c div > table,\n.body.c div > pre, .body.c > table, .body.c > pre,\n.body.j > table, .body.j > pre, .body.j div > table,\n.body.j div > pre, .body.j > table, .body.j > pre,\n.body.c p.note, .body.c p.warning, .body.c p.error, .body.c p.fatal,\n.body.j p.note, .body.j p.warning, .body.j p.error, .body.j p.fatal,\n.body.c > table.layoutcontainer, .body.j > table.layoutcontainer { margin-left: auto; margin-right: auto }\n.layoutregion.l table, .layoutregion.l pre, .layoutregion.l p.note,\n.layoutregion.l p.warning, .layoutregion.l p.error, .layoutregion.l p.fatal { margin-left: 0 }\n.layoutregion.c table, .layoutregion.c pre, .layoutregion.c p.note,\n.layoutregion.c p.warning, .layoutregion.c p.error, .layoutregion.c p.fatal { margin-left: auto; margin-right: auto }\n.layoutregion.r table, .layoutregion.r pre, .layoutregion.r p.note,\n.layoutregion.r table, .layoutregion.r pre, .layoutregion.r p.note,\n.layoutregion.r p.warning, .layoutregion.r p.error, .layoutregion.r p.fatal { margin-right: 0 }\narticle, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block }\nhtml{ font-size: 100% }\n.body { margin: 1em; font-size: 13px; line-height: 1.231 }\nsup { position: relative; vertical-align: baseline; bottom: 0.25em; font-size: 0.8em }\nsub { position: relative; vertical-align: baseline; top: 0.25em; font-size: 0.8em }\nul, ol { margin: 1em 0; padding: 0 0 0 40px }\ndd { margin: 0 0 0 40px }\nnav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0 }\nimg { border: 0; vertical-align: middle }\nsvg:not(:root) { overflow: hidden }\nfigure { margin: 0 }\ntable { border-collapse: collapse; border-spacing: 0 }\n.layoutcontainer { border-collapse: separate; border-spacing: 0 }\np { margin-top: 0; text-align: left }\nh1.heading1 { text-align: left }\nh2.heading2 { text-align: left }\nh3.heading3 { text-align: left }\nh4.heading4 { text-align: left }\nh5.heading5 { text-align: left }\nh6.heading6 { text-align: left }\nspan { text-align: left }\ntable { margin-bottom: 1em }\ntd, th { text-align: left; padding: 3px 6px; vertical-align: top }\ntd[class$=\"fixed\"], th[class$=\"fixed\"] { white-space: pre }\nsection, article { padding-top: 1px; padding-bottom: 8px }\nhr.pagebreak { height: 0px; border: 0; border-bottom: 1px solid #c0c0c0; margin: 1em 0 }\n.stacked-value { text-align: left; display: block }\n.stacked-cell > .stacked-value, td.data > td.data, th.data > td.data, th.data > th.data, td.data > th.data, th.header > th.header { border: 0 }\n.stacked-cell > div.data { border-width: 0 }\n.systitleandfootercontainer { white-space: nowrap; margin-bottom: 1em }\n.systitleandfootercontainer > p { margin: 0 }\n.systitleandfootercontainer > p > span { display: inline-block; width: 100%; white-space: normal }\n.batch { display: table }\n.toc { display: none }\n.proc_note_group, .proc_title_group { margin-bottom: 1em }\np.proctitle { margin: 0 }\np.note, p.warning, p.error, p.fatal { display: table }\n.notebanner, .warnbanner, .errorbanner, .fatalbanner,\n.notecontent, .warncontent, .errorcontent, .fatalcontent { display: table-cell; padding: 0.5em }\n.notebanner, .warnbanner, .errorbanner, .fatalbanner { padding-right: 0 }\n.body > div > ol li { text-align: left }\n.beforecaption > h4 { margin-top: 0; margin-bottom: 0 }\n.c { text-align: center }\n.r { text-align: right }\n.l { text-align: left }\n.j { text-align: justify }\n.d { text-align: right }\n.b { vertical-align: bottom }\n.m { vertical-align: middle }\n.t { vertical-align: top }\n.accessiblecaption {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\na:active { color: #800080 }\n.aftercaption {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n    padding-top: 4pt;\n}\n.batch > colgroup {\n    border-left: 1px solid #c1c1c1;\n    border-right: 1px solid #c1c1c1;\n}\n.batch > tbody, .batch > thead, .batch > tfoot {\n    border-top: 1px solid #c1c1c1;\n    border-bottom: 1px solid #c1c1c1;\n}\n.batch { border: hidden; }\n.batch {\n    background-color: #fafbfe;\n    border: 1px solid #c1c1c1;\n    border-collapse: separate;\n    border-spacing: 1px;\n    color: #000000;\n    font-family: \"SAS Monospace\", \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    padding: 7px;\n    }\n.beforecaption {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.body {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    margin-left: 8px;\n    margin-right: 8px;\n}\n.bodydate {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    text-align: right;\n    vertical-align: top;\n    width: 100%;\n}\n.bycontentfolder {\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: none;\n    margin-left: 6pt;\n}\n.byline {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.bylinecontainer > col, .bylinecontainer > colgroup > col, .bylinecontainer > colgroup, .bylinecontainer > tr, .bylinecontainer > * > tr, .bylinecontainer > thead, .bylinecontainer > tbody, .bylinecontainer > tfoot { border: none; }\n.bylinecontainer {\n    background-color: #fafbfe;\n    border: none;\n    border-spacing: 1px;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    width: 100%;\n}\n.caption {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.cell, .container {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.contentfolder, .contentitem {\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: none;\n    margin-left: 6pt;\n}\n.contentproclabel, .contentprocname {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.contents {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: decimal;\n    margin-left: 8px;\n    margin-right: 8px;\n}\n.contentsdate {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    width: 100%;\n}\n.contenttitle {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: bold;\n}\n.continued {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n    width: 100%;\n}\n.data, .dataemphasis {\n    background-color: #ffffff;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.dataemphasisfixed {\n    background-color: #ffffff;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.dataempty {\n    background-color: #ffffff;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.datafixed {\n    background-color: #ffffff;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.datastrong {\n    background-color: #ffffff;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.datastrongfixed {\n    background-color: #ffffff;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #000000;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.date {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    width: 100%;\n}\n.document {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.errorbanner {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.errorcontent {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.errorcontentfixed {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.extendedpage {\n    background-color: #fafbfe;\n    border-style: solid;\n    border-width: 1pt;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n    text-align: center;\n}\n.fatalbanner {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.fatalcontent {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.fatalcontentfixed {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.folderaction {\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: none;\n    margin-left: 6pt;\n}\n.footer {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.footeremphasis {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.footeremphasisfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.footerempty {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.footerfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.footerstrong {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.footerstrongfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.frame {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.graph > colgroup {\n    border-left: 1px solid #c1c1c1;\n    border-right: 1px solid #c1c1c1;\n}\n.graph > tbody, .graph > thead, .graph > tfoot {\n    border-top: 1px solid #c1c1c1;\n    border-bottom: 1px solid #c1c1c1;\n}\n.graph { border: hidden; }\n.graph {\n    background-color: #fafbfe;\n    border: 1px solid #c1c1c1;\n    border-collapse: separate;\n    border-spacing: 1px;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    }\n.header {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.headeremphasis {\n    background-color: #d8dbd3;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.headeremphasisfixed {\n    background-color: #d8dbd3;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #000000;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.headerempty {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.headerfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.headersandfooters {\n    background-color: #edf2f9;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.headerstrong {\n    background-color: #d8dbd3;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.headerstrongfixed {\n    background-color: #d8dbd3;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #000000;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.heading1, .heading2, .heading3, .heading4, .heading5, .heading6 { font-family: Arial, Helvetica, sans-serif }\n.index {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.indexaction, .indexitem {\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: none;\n    margin-left: 6pt;\n}\n.indexprocname {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.indextitle {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: bold;\n}\n.layoutcontainer, .layoutregion {\n    border-width: 0;\n    border-spacing: 30px;\n}\n.linecontent {\n    background-color: #fafbfe;\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\na:link { color: #0000ff }\n.list {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: disc;\n}\n.list10 {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: square;\n}\n.list2 {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: circle;\n}\n.list3, .list4, .list5, .list6, .list7, .list8, .list9 {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: square;\n}\n.listitem {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: disc;\n}\n.listitem10 {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: square;\n}\n.listitem2 {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: circle;\n}\n.listitem3, .listitem4, .listitem5, .listitem6, .listitem7, .listitem8, .listitem9 {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: square;\n}\n.note {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.notebanner {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.notecontent {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.notecontentfixed {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.output > colgroup {\n    border-left: 1px solid #c1c1c1;\n    border-right: 1px solid #c1c1c1;\n}\n.output > tbody, .output > thead, .output > tfoot {\n    border-top: 1px solid #c1c1c1;\n    border-bottom: 1px solid #c1c1c1;\n}\n.output { border: hidden; }\n.output {\n    background-color: #fafbfe;\n    border: 1px solid #c1c1c1;\n    border-collapse: separate;\n    border-spacing: 1px;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    }\n.pageno {\n    background-color: #fafbfe;\n    border-spacing: 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n    text-align: right;\n    vertical-align: top;\n}\n.pages {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: decimal;\n    margin-left: 8px;\n    margin-right: 8px;\n}\n.pagesdate {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    width: 100%;\n}\n.pagesitem {\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    list-style-type: none;\n    margin-left: 6pt;\n}\n.pagesproclabel, .pagesprocname {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.pagestitle {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: bold;\n}\n.paragraph {\n    background-color: #fafbfe;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.parskip > col, .parskip > colgroup > col, .parskip > colgroup, .parskip > tr, .parskip > * > tr, .parskip > thead, .parskip > tbody, .parskip > tfoot { border: none; }\n.parskip {\n    border: none;\n    border-spacing: 0;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n    }\n.prepage {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    text-align: left;\n}\n.proctitle {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.proctitlefixed {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowfooter {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowfooteremphasis {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.rowfooteremphasisfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.rowfooterempty {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowfooterfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.rowfooterstrong {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowfooterstrongfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowheader {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowheaderemphasis {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.rowheaderemphasisfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: italic;\n    font-weight: normal;\n}\n.rowheaderempty {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowheaderfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.rowheaderstrong {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.rowheaderstrongfixed {\n    background-color: #edf2f9;\n    border-color: #b0b7bb;\n    border-style: solid;\n    border-width: 0 1px 1px 0;\n    color: #112277;\n    font-family: \"Courier New\", Courier, monospace;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.systemfooter, .systemfooter10, .systemfooter2, .systemfooter3, .systemfooter4, .systemfooter5, .systemfooter6, .systemfooter7, .systemfooter8, .systemfooter9 {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.systemtitle, .systemtitle10, .systemtitle2, .systemtitle3, .systemtitle4, .systemtitle5, .systemtitle6, .systemtitle7, .systemtitle8, .systemtitle9 {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size: small;\n    font-style: normal;\n    font-weight: bold;\n}\n.systitleandfootercontainer > col, .systitleandfootercontainer > colgroup > col, .systitleandfootercontainer > colgroup, .systitleandfootercontainer > tr, .systitleandfootercontainer > * > tr, .systitleandfootercontainer > thead, .systitleandfootercontainer > tbody, .systitleandfootercontainer > tfoot { border: none; }\n.systitleandfootercontainer {\n    background-color: #fafbfe;\n    border: none;\n    border-spacing: 1px;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    width: 100%;\n}\n.table > col, .table > colgroup > col {\n    border-left: 1px solid #c1c1c1;\n    border-right: 0 solid #c1c1c1;\n}\n.table > tr, .table > * > tr {\n    border-top: 1px solid #c1c1c1;\n    border-bottom: 0 solid #c1c1c1;\n}\n.table { border: hidden; }\n.table {\n    border-color: #c1c1c1;\n    border-style: solid;\n    border-width: 1px 0 0 1px;\n    border-collapse: collapse;\n    border-spacing: 0;\n    }\n.titleandnotecontainer > col, .titleandnotecontainer > colgroup > col, .titleandnotecontainer > colgroup, .titleandnotecontainer > tr, .titleandnotecontainer > * > tr, .titleandnotecontainer > thead, .titleandnotecontainer > tbody, .titleandnotecontainer > tfoot { border: none; }\n.titleandnotecontainer {\n    background-color: #fafbfe;\n    border: none;\n    border-spacing: 1px;\n    color: #000000;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n    width: 100%;\n}\n.titlesandfooters {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.usertext {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\na:visited { color: #800080 }\n.warnbanner {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: bold;\n}\n.warncontent {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: Arial, \"Albany AMT\", Helvetica, Helv;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n.warncontentfixed {\n    background-color: #fafbfe;\n    color: #112277;\n    font-family: \"Courier New\", Courier;\n    font-size:  normal;\n    font-style: normal;\n    font-weight: normal;\n}\n/*]]>*/\n</style>\n</head>\n<body class=\"l body\">\n<div style=\"padding-bottom: 8px; padding-top: 1px\">\n<div id=\"IDX\" class=\"systitleandfootercontainer\" style=\"border-spacing: 1px\">\n<p><span class=\"c systemtitle\">The SAS System</span> </p>\n</div>\n<div class=\"proc_title_group\">\n<p class=\"c proctitle\">The MEANS Procedure</p>\n</div>\n<div style=\"padding-bottom: 8px; padding-top: 1px\">\n<table class=\"table\" style=\"border-spacing: 0\" aria-label=\"Summary statistics\">\n<caption aria-label=\"Summary statistics\"></caption>\n<colgroup><col/><col/></colgroup><colgroup><col/><col/><col/><col/><col/></colgroup>\n<thead>\n<tr>\n<th class=\"b header\" scope=\"col\">Variable</th>\n<th class=\"b header\" scope=\"col\">Label</th>\n<th class=\"r b header\" scope=\"col\">N</th>\n<th class=\"r b header\" scope=\"col\">Mean</th>\n<th class=\"r b header\" scope=\"col\">Std Dev</th>\n<th class=\"r b header\" scope=\"col\">Minimum</th>\n<th class=\"r b header\" scope=\"col\">Maximum</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<th class=\"data\">\n<div class=\"stacked-cell\">\n<div>MSRP</div>\n<div>Invoice</div>\n<div>EngineSize</div>\n<div>Cylinders</div>\n<div>Horsepower</div>\n<div>MPG_City</div>\n<div>MPG_Highway</div>\n<div>Weight</div>\n<div>Wheelbase</div>\n<div>Length</div>\n</div>\n</th>\n<th class=\"data\">\n<div class=\"stacked-cell\">\n<div>&#160;</div>\n<div>&#160;</div>\n<div>Engine Size (L)</div>\n<div>&#160;</div>\n<div>&#160;</div>\n<div>MPG (City)</div>\n<div>MPG (Highway)</div>\n<div>Weight (LBS)</div>\n<div>Wheelbase (IN)</div>\n<div>Length (IN)</div>\n</div>\n</th>\n<td class=\"r data\">\n<div class=\"stacked-cell\">\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n<div class=\"r\">426</div>\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n<div class=\"r\">428</div>\n</div>\n</td>\n<td class=\"r data\">\n<div class=\"stacked-cell\">\n<div class=\"r\">32774.86</div>\n<div class=\"r\">30014.70</div>\n<div class=\"r\">3.1967290</div>\n<div class=\"r\">5.8075117</div>\n<div class=\"r\">215.8855140</div>\n<div class=\"r\">20.0607477</div>\n<div class=\"r\">26.8434579</div>\n<div class=\"r\">3577.95</div>\n<div class=\"r\">108.1542056</div>\n<div class=\"r\">186.3621495</div>\n</div>\n</td>\n<td class=\"r data\">\n<div class=\"stacked-cell\">\n<div class=\"r\">19431.72</div>\n<div class=\"r\">17642.12</div>\n<div class=\"r\">1.1085947</div>\n<div class=\"r\">1.5584426</div>\n<div class=\"r\">71.8360316</div>\n<div class=\"r\">5.2382176</div>\n<div class=\"r\">5.7412007</div>\n<div class=\"r\">758.9832146</div>\n<div class=\"r\">8.3118130</div>\n<div class=\"r\">14.3579913</div>\n</div>\n</td>\n<td class=\"r data\">\n<div class=\"stacked-cell\">\n<div class=\"r\">10280.00</div>\n<div class=\"r\">9875.00</div>\n<div class=\"r\">1.3000000</div>\n<div class=\"r\">3.0000000</div>\n<div class=\"r\">73.0000000</div>\n<div class=\"r\">10.0000000</div>\n<div class=\"r\">12.0000000</div>\n<div class=\"r\">1850.00</div>\n<div class=\"r\">89.0000000</div>\n<div class=\"r\">143.0000000</div>\n</div>\n</td>\n<td class=\"r data\">\n<div class=\"stacked-cell\">\n<div class=\"r\">192465.00</div>\n<div class=\"r\">173560.00</div>\n<div class=\"r\">8.3000000</div>\n<div class=\"r\">12.0000000</div>\n<div class=\"r\">500.0000000</div>\n<div class=\"r\">60.0000000</div>\n<div class=\"r\">66.0000000</div>\n<div class=\"r\">7190.00</div>\n<div class=\"r\">144.0000000</div>\n<div class=\"r\">238.0000000</div>\n</div>\n</td>\n</tr>\n</tbody>\n</table>\n</div>\n</div>\n</body>\n</html>\n"
    #>
    #> $x$log
    #> [1] "\0245                                                          The SAS System                      Sunday, February 22, 2026 12:45:00 AM\n\n24         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg style=HTMLBlue;\n24       ! ods graphics on / outputfmt=png;\n25         \n26         PROC MEANS DATA = sashelp.cars; RUN;\n27         \n28         \n29         ods html5 (id=saspy_internal) close;ods listing;\n30         \n\0246                                                          The SAS System                      Sunday, February 22, 2026 12:45:00 AM\n\n31         "
    #>
    #> $x$capture
    #> [1] "both"
    #>
    #>
    #> $width
    #> [1] "auto"
    #>
    #> $height
    #> [1] "auto"
    #>
    #> $sizingPolicy
    #> $sizingPolicy$defaultWidth
    #> NULL
    #>
    #> $sizingPolicy$defaultHeight
    #> NULL
    #>
    #> $sizingPolicy$padding
    #> [1] 0
    #>
    #> $sizingPolicy$fill
    #> NULL
    #>
    #> $sizingPolicy$viewer
    #> $sizingPolicy$viewer$defaultWidth
    #> NULL
    #>
    #> $sizingPolicy$viewer$defaultHeight
    #> NULL
    #>
    #> $sizingPolicy$viewer$padding
    #> NULL
    #>
    #> $sizingPolicy$viewer$fill
    #> [1] TRUE
    #>
    #> $sizingPolicy$viewer$suppress
    #> [1] FALSE
    #>
    #> $sizingPolicy$viewer$paneHeight
    #> NULL
    #>
    #>
    #> $sizingPolicy$browser
    #> $sizingPolicy$browser$defaultWidth
    #> NULL
    #>
    #> $sizingPolicy$browser$defaultHeight
    #> NULL
    #>
    #> $sizingPolicy$browser$padding
    #> NULL
    #>
    #> $sizingPolicy$browser$fill
    #> [1] TRUE
    #>
    #> $sizingPolicy$browser$external
    #> [1] FALSE
    #>
    #>
    #> $sizingPolicy$knitr
    #> $sizingPolicy$knitr$defaultWidth
    #> NULL
    #>
    #> $sizingPolicy$knitr$defaultHeight
    #> NULL
    #>
    #> $sizingPolicy$knitr$figure
    #> [1] TRUE
    #>
    #>
    #>
    #> $dependencies
    #> NULL
    #>
    #> $elementId
    #> NULL
    #>
    #> $preRenderHook
    #> NULL
    #>
    #> $jsHooks
    #> list()
    #>
    #> attr(,"class")
    #> [1] "sas_widget" "htmlwidget"
    #> attr(,"package")
    #> [1] "sasquatch"

To execute a SAS script use `sas_run_file()`. You can even save the raw SAS HTML output and log by specifing an output path for the HTML.

    cat("PROC MEANS DATA = sashelp.cars;RUN;", file = "script.sas")
    sas_widget <- sas_run_file("script.sas")

    # will save output.html and output.log files
    sas_run_file("script.sas", "output.html")

### Within quarto

Quarto documents are a great way to use SAS and R together because they couple R and SAS within a single reproducable document.

You can create a `sasquatch` quarto document by:

- Specifying the format as html or pdf
- Specifying the engine as knitr
- Creating an R code block with `library(sasquatch); sas_connect()`

Now, SAS code can be contained within “sas” code blocks.

    ---
    format: html
    engine: knitr
    ---

    ```{r}
    library(sasquatch)
    sas_connect()
    ```

    ```{sas}
    PROC MEANS DATA = sashelp.cars;
    RUN;
    ```

#### RStudio

In RStudio, you will be able to run SAS chunks as you would any other chunk.

If you want to be able to view SAS output within the Viewer instead of beneath the chunk, you can utilize the `sas_run_selected()` addin. To add a keyboard shortcut for this addin, open Tools -> Modify Keyboard Shortcuts and search “Run selected in SAS”, type in the box under Shortcut to set the keyboard shortcut to your liking and click Apply.

#### Positron

In Positron, you will not be able to run SAS chunks as you would R or Python chunks. However, just as in RStudio, you can create a keyboard shortcut which will allow you to view SAS output within the Plots pane. Open up the command palette with `ctrl+shift+p` or `command+shift+p` and search “Preferences: Open Keyboard Shortcuts (JSON)”. Add the following to your shortcuts.

    {
        "key": "ctrl+shift+enter",
        "command": "workbench.action.executeCode.console",
        "when": "editorTextFocus",
        "args": {
            "langId": "r",
            "code": "sasquatch::sas_run_selected()",
            "focus": true
        }
    }

Edit the `key` argument to set your preferred shortcut.

## Data conversion

R `data.frame`s can be automatically converted to and from SAS tables. However, `data.frame`s must only contain logical, integer, double, factor, character, POSIXct, or Date class columns.

Convert R `data.frame`s to SAS tables with `sas_from_r()`.

    df <- data.frame(
      double = c(1, 2.5, NA),
      integer = c(1:2, NA),
      logical = c(T, F, NA),
      character = c("a", "b", NA),
      factor = factor(c("a", "b", NA)),
      date = as.Date("2015-12-09") + c(1:2, NA),
      datetime = as.POSIXct("2015-12-09 10:51:34.5678", tz = "UTC") + c(1:2, NA)
    )
    tibble::tibble(df)
    #> # A tibble: 3 × 7
    #>   double integer logical character factor date       datetime
    #>    <dbl>   <int> <lgl>   <chr>     <fct>  <date>     <dttm>
    #> 1    1         1 TRUE    a         a      2015-12-10 2015-12-09 10:51:35
    #> 2    2.5       2 FALSE   b         b      2015-12-11 2015-12-09 10:51:36
    #> 3   NA        NA NA      NA        NA     NA         NA

    sas_from_r(df, "df", libref = "WORK")

SAS only has two data types (numeric and character). R data types are converted as follows:

- logical -> numeric
- integer -> numeric
- double -> numeric
- factor -> character
- character -> character
- POSIXct -> numeric (datetime; timezones are lost)
- Date -> numeric (date)

And convert SAS tables back to R `data.frame`s with `sas_to_r()`.

    df <- sas_to_r("df", libref = "WORK")

    tibble::tibble(df)
    #> # A tibble: 3 × 7
    #>   double integer logical character factor date                datetime
    #>    <dbl>   <dbl>   <dbl> <chr>     <chr>  <dttm>              <dttm>
    #> 1    1         1       1 a         a      2015-12-10 00:00:00 2015-12-09 10:51:35
    #> 2    2.5       2       0 b         b      2015-12-11 00:00:00 2015-12-09 10:51:36
    #> 3   NA        NA      NA NA        NA     NA                  NA

SAS data types are converted as follows:

- numeric -> double
- character -> character
- numeric (datetime; timezones are lost) -> POSIXct
- numeric (date) -> POSIXct

## File management

`sasquatch` offers a few different functions to manage remote SAS files.

Upload files to a remote SAS server with `sas_file_upload()`.

    cat("PROC MEANS DATA = sashelp.cars;RUN;", file = "script.sas")
    sas_file_upload(local_path = "script.sas", sas_path = "~/script.sas")

Download files from a remote SAS server with `sas_file_download()`.

    sas_file_download(sas_path = "~/script.sas", local_path = "script.sas")

Check if a file exists on the remote SAS server with `sas_file_exists()`.

    sas_file_exists("~/script.sas")

Copy files on the remote SAS server with `sas_file_copy()`.

    sas_file_copy("~/script.sas", "~/script_copy.sas")

Remove files from a remote SAS server with `sas_file_remove()`.

    sas_file_remove("~/script_copy.sas")

List all files and directories within a remote SAS server with `sas_list()`.

    sas_list("~")
    #> [1] "directory1" "file1.csv" "file2.sas"