Learn R Programming

SASxport (version 1.2.3)

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

Description

Describe the contents of an SAS XPORT file.

Usage

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

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:

  • datasetDataset name,
  • nameVariable name,
  • typeType of variable (one of 'character' or 'numeric'),
  • formatSAS format,
  • widthSAS format width,
  • labelVariable label,
  • nobsNumber of observations.

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.

See Also

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

Examples

Run this code
setwd(file.path(.path.package("SASxport"),"data"))
## Get information on a local file
lookup.xport("Alfalfa.xpt")

## Or read a copy of test2.xpt available on the web:
host <- 'http://biostat.mc.vanderbilt.edu'
path <- '/cgi-bin/viewvc.cgi/*checkout*/Hmisc/trunk/tests/test2.xpt'
url <- paste(host,path,sep="")

w <- lookup.xport(url)

# 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

Run the code above in your browser using DataLab