help bugsdat
-------------------------------------------------------------------------------

Title

WinBUGS Splus dataset creation

Syntax

bugsdat varlist [if] [, options]

options Description ------------------------------------------------------------------------- Main dim(string) specifies the additional option that each column of data can be split into an array. data(string) specifies text to be added at the start of the Splus dataset. file(newfilename) specifies that the Splus dataset is saved into a specific dataset. name(newvarlist) specifies that the Splus dataset uses an alternative set of variable names in the output dataset. -------------------------------------------------------------------------

Description

bugsdat will convert selected variables from the loaded STATA dataset into a text file that can be read into the WinBUGS software package. The text file is created using a log file so will automatically close open log files. The resulting file will be an ASCII file that can be easily cut and pasted into WinBUGS. Note if you run this command quietly the log file will therefore be empty.

Note that as the text file is created by a log file the number of characters on a line is dictated by the system limits on the linesize.

All missing values will be converted to NA

Latest Version

The latest version is always kept on the SSC website. To install the latest version click on the following link

ssc install bugsdat, replace.

Options

dim(string) specifies the additional option that each column of data can be split into an array. The string part of the option specifies the dimensions to be placed in the Splus .Dim=c(string) statement.

file(newfilename) specifies that the Splus dataset is saved into a specific dataset. The default dataset is bugsdat.dat.

name(newvarlist) specifies that the Splus dataset uses an alternative set of variable names in the output dataset.

data(string) specifies text to be added at the start of the Splus dataset. This is useful for additing a single value to a large dataset.

Examples

The examples use the system dataset auto.dta. Click on the links below to see the command working.

sysuse auto

Create the basic Splus dataset

bugsdat mpg make

Specify that each column forms an 37 by 2 array

bugsdat mpg make, d(37,2)

Then save the file to auto.dat. Note that in your directory there should be two files bugsdat.dat and auto.dat.

bugsdat mpg make, d(37,2) f(auto.dat)

Additionally new variable names can be specified using the name option. This can allow any string values and hence can specify names that STATA does not accept like new.mpg.

bugsdat mpg make, d(37,2) f(auto.dat) name(new.mpg new.make)

bugsdat mpg make, d(37,2) f(auto.dat) name(new.mpg new.make) data(N=37,)

Author

Adrian Mander, MRC Human Nutrition Research, Cambridge, UK.

Email: adrian.mander@mrc-hnr.cam.ac.uk