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

From PHUSE Wiki
Jump to: navigation, search
(Created page with "'''Instructions for accessing datasets and executing SAS and R scripts which exist in PhUSE/FDA Code Repository ''' This Wiki page is an attempt to describe two things: 1) ho...")
 
Line 3: Line 3:
  
 
This Wiki page is an attempt to describe two things:
 
This Wiki page is an attempt to describe two things:
 +
 
1) how to access dataset files which are hosted in the Code Repository
 
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
 
2) how to execute scripts which are hosted in the Code Repository
  
Line 19: Line 21:
 
filename source url
 
filename source url
 
"http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt")
 
"http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt")
 +
 
libname source xport ;
 
libname source xport ;
 +
 
data work.adsl ;
 
data work.adsl ;
  set source.adsl ;
+
 
 +
set source.adsl ;
 +
 
 
run ;
 
run ;
  
 
To access this dataset in R, here's the code to use:
 
To access this dataset in R, here's the code to use:
 
library(SASxport)
 
library(SASxport)
 +
 
adsl <- read.xport(file=
 
adsl <- read.xport(file=
 
"http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt")
 
"http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt")
Line 45: Line 52:
  
 
To execute the SAS script in your SAS environment, execute:
 
To execute the SAS script in your SAS environment, execute:
 +
 
options source2 ;
 
options source2 ;
 +
 
filename code url
 
filename code url
 +
 
"http://phuse-scripts.googlecode.com/svn/trunk/lang/SAS/report/test/src/summary.sas" ;
 
"http://phuse-scripts.googlecode.com/svn/trunk/lang/SAS/report/test/src/summary.sas" ;
 +
 
%include code ;
 
%include code ;

Revision as of 09:03, 20 August 2013

Instructions for accessing datasets and executing SAS and R scripts which exist in 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

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://code.google.com/p/phuse-scripts/source/browse/trunk/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 "http://phuse-scripts.googlecode.com/svn/trunk/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= "http://phuse-scripts.googlecode.com/svn/trunk/lang/R/report/test/data/adsl.xpt")

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

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://code.google.com/p/phuse-scripts/source/browse/trunk/lang/R/report/test/src/adsl.R

SAS script: https://code.google.com/p/phuse-scripts/source/browse/trunk/lang/SAS/report/test/src/summary.sas

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)

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

options source2 ;

filename code url

"http://phuse-scripts.googlecode.com/svn/trunk/lang/SAS/report/test/src/summary.sas" ;

%include code ;