• SAS and R
  • 1 Welcome
  • 2 About
    • 2.1 Organization
      • 2.1.1 First Steps
      • 2.1.2 Data
      • 2.1.3 Tables
      • 2.1.4 Plots
      • 2.1.5 Packages
    • 2.2 House Keeping
      • 2.2.1 Philosophy
      • 2.2.2 Approach
      • 2.2.3 Contributing
  • 3 First Steps in R
    • 3.1 R and SAS Syntax
      • 3.1.1 Packages and Sample Data
      • 3.1.2 PROC CONTENTS \(\rightarrow\) summary()
      • 3.1.3 PROC FREQ \(\rightarrow\) count()
      • 3.1.4 KEEP/DROP \(\rightarrow\) select()
      • 3.1.5 Subsetting data (WHERE/IF) \(\rightarrow\) filter()
      • 3.1.6 Sorting data
      • 3.1.7 Creating new variables
      • 3.1.8 Handling of missing values
      • 3.1.9 Merging Data
      • 3.1.10 Concatenating Data
  • 4 Data
    • 4.1 External Data
      • 4.1.1 CDISC Datasets
    • 4.2 Internal Data
      • 4.2.1 Package Data
      • 4.2.2 Simulating Your Own
  • 5 Tables
    • 5.1 Building
      • 5.1.1 Dataset Source
      • 5.1.2 String Formatting
      • 5.1.3 Create
    • 5.2 Formatting
      • 5.2.1 Post Processing
      • 5.2.2 Displaying
    • 5.3 Exporting
  • 6 Figures & Plots
    • 6.1 Basics
      • 6.1.1 Building a plot using ggplot2
      • 6.1.2 Exporting plots
    • 6.2 Examples
      • 6.2.1 Swimmer Plot
      • 6.2.2 Waterfall Plot
      • 6.2.3 Spaghetti Plot
      • 6.2.4 Spider Plot
      • 6.2.5 Survival Plot
      • 6.2.6 Scatter Plot
      • 6.2.7 Tornado Plot
      • 6.2.8 Safety Plots
  • 7 Clinical Statistics in R
  • 8 Future
    • 8.1 Use {renv}
    • 8.2 Areas of Expansion
    • 8.3 Content
  • 9 Hybrid Programming with SAS and R
    • 9.1 Use {sasr}
    • 9.2 Use {jupyter}/{quarto} and {saspy}
    • 9.3 Use {SASmarkdown}
    • 9.4 SAS with command line or ssh (not recommended)
  • 10 License
  • Published with bookdown

SAS and R

9.4 SAS with command line or ssh (not recommended)

As SAS can be called through command line, we can actually use the following to execute SAS codes

sas script.sas

or, we can call SAS in R side

system("sas script.sas")
# using ssh

library(ssh)
ssh_connect()
scp_upload()
ssh_exec("sas script.sas")

Please note that using command line, you will need to have SAS installed on your machine.