Difference between revisions of "Executing SAS and R Scripts in Repository"

From PHUSE Wiki
Jump to: navigation, search
m
 
Line 13: Line 13:
 
The ADSL dataset created as part of the CDISC ADaM Pilot project is currently hosted in the repository as:
 
The ADSL dataset created as part of the CDISC ADaM Pilot project is currently hosted in the repository as:
  
https://code.google.com/p/phuse-scripts/source/browse/trunk/lang/R/report/test/data/adsl.xpt
+
https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/data/adsl.xpt
  
 
(this is a SAS Version 5 transport file)
 
(this is a SAS Version 5 transport file)
Line 19: Line 19:
 
'''To access this dataset in SAS, here's the code to use:'''
 
'''To access this dataset in SAS, here's the code to use:'''
 
<syntaxhighlight lang="sas">
 
<syntaxhighlight lang="sas">
filename source url "http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt"
+
filename source url "https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/data/adsl.xpt"
 
libname source xport ;
 
libname source xport ;
 
data work.adsl ;
 
data work.adsl ;
Line 28: Line 28:
  
 
   library(SASxport)
 
   library(SASxport)
   adsl <- read.xport(file="http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt")
+
   adsl <- read.xport(file="https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/data/adsl.xpt")
  
 
(note that the easily-available R package "SASxport" needs to be installed)
 
(note that the easily-available R package "SASxport" needs to be installed)
Line 39: Line 39:
 
R Script:
 
R Script:
  
https://code.google.com/p/phuse-scripts/source/browse/trunk/lang/R/report/test/src/adsl.R
+
https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/src/adsl.R
  
 
SAS script:
 
SAS script:
  
https://code.google.com/p/phuse-scripts/source/browse/trunk/lang/SAS/report/test/src/summary.sas
+
https://github.com/phuse-org/phuse-scripts/tree/master/lang/SAS/report/test/src/summary.sas
  
 
'''To execute the R script in your R environment, execute:
 
'''To execute the R script in your R environment, execute:
 
'''
 
'''
  
   source("http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/src/adsl.R",echo=T)
+
   source("https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/src/adsl.R",echo=T)
  
  
Line 55: Line 55:
 
<syntaxhighlight lang="sas">
 
<syntaxhighlight lang="sas">
 
   options source2 ;
 
   options source2 ;
   filename code url "http://phuse-scripts.googlecode.com/svn/trunk/lang/SAS/report/test/src/summary.sas" ;
+
   filename code url "https://github.com/phuse-org/phuse-scripts/tree/master/lang/SAS/report/test/src/summary.sas" ;
 
   %include code ;
 
   %include code ;
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 14:11, 13 October 2015

Instructions for accessing datasets and executing SAS and R scripts which exist in the PhUSE/FDA Code Repository

This Wiki page is an attempt to describe two things:

1) how to access dataset files which are hosted in the Code Repository

2) how to execute scripts which are hosted in the Code Repository

1. How to access dataset files which are hosted in the Code Repository

The ADSL dataset created as part of the CDISC ADaM Pilot project is currently hosted in the repository as:

https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/data/adsl.xpt

(this is a SAS Version 5 transport file)

To access this dataset in SAS, here's the code to use:

filename source url "https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/data/adsl.xpt"
libname source xport ;
data work.adsl ;
  set source.adsl ;
run ;

To access this dataset in R, here's the code to use:

 library(SASxport)
 adsl <- read.xport(file="https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/data/adsl.xpt")

(note that the easily-available R package "SASxport" needs to be installed)

2. How to execute SAS and R scripts which are hosted in the Code Repository

Two example scripts are hosted in the respository for you to test:

R Script:

https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/src/adsl.R

SAS script:

https://github.com/phuse-org/phuse-scripts/tree/master/lang/SAS/report/test/src/summary.sas

To execute the R script in your R environment, execute:

 source("https://github.com/phuse-org/phuse-scripts/tree/master/lang/R/report/test/src/adsl.R",echo=T)


To execute the SAS script in your SAS environment, execute:

  options source2 ;
  filename code url "https://github.com/phuse-org/phuse-scripts/tree/master/lang/SAS/report/test/src/summary.sas" ;
  %include code ;