lookup.xport: Describe the Contents of an SAS XPORT File

Description Usage Arguments Details Value See Also Examples

View source: R/lookup.xport.R

Description

Describe the contents of an SAS XPORT file.

Usage

1
2
3
4
5
6
7
lookup.xport(file)
## S3 method for class 'lookup.xport'
print(x, ...)
## S3 method for class 'lookup.xport'
summary(object, ...)
## S3 method for class 'summary.lookup.xport'
print(x, ...)

Arguments

file

Character string specifying the name or URL of a SAS XPORT file.

x, object

Object to be printed or summarized

...

Optional arguments

Details

The lookup.xport function is a simple wrapper for the lookup.xport function provided by the foreign library. The wrapper adds the ability to handle URL's, and returns an object of class lookup.xport for which appropriate print, and summary functions are provided.

Value

lookup.xport returns a list with one component for each dataset in the XPORT format library.

summary.lookup.xport returns a single data frame containing:

dataset

Dataset name,

name

Variable name,

type

Type of variable (one of 'character' or 'numeric'),

format

SAS format,

width

SAS format width,

label

Variable label,

nobs

Number of observations.

See Also

For complete documentation of lookup.xport see the manual page for lookup.xport.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Get information about a local file
alfFile <- system.file('extdata', 'Alfalfa.xpt', package='SASxport')
lookup.xport(alfFile)

## Read a copy of test2.xpt available on the web:
## Not run: 
url <- 'http://biostat.mc.vanderbilt.edu/wiki/pub/Main/Hmisc/test2.xpt'
w <- lookup.xport(url)

## End(Not run)
## Or use the local copy...
testFile <- system.file('extdata', 'test2.xpt', package="SASxport")
w <- lookup.xport(testFile)


# display the information (calls 'print.lookup.xport')
w

# names of data sets
names(w)

# names of variables within data sets
w$Z$name

# use summary
wS <- summary(w)
wS # same display

# variable names within all data sets
wS$name 

SASxport documentation built on March 13, 2020, 1:59 a.m.