Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: stata to winbugs

From   "David Harrison" <>
To   <>
Subject   st: RE: stata to winbugs
Date   Fri, 5 Nov 2004 09:52:04 -0000

A while ago, I produced the following program which produces a rectangular format with variable names at the top - haven't used it for a long time and I can't remember how well it works, but feel free to play with it! The -list- option just puts an S-plus format list at the top of the file for specifying constants etc.


program define outbugs
    version 8
    syntax [varlist] [if] [in] using/ [, list(string) noLabel replace ]
	if index("`using'",".")==0 {
        local using "`using'.txt"
	foreach v of varlist `varlist' {
        char `v'[varname] "`v'[]"
    set more off
	qui log using `"`using'"', text `replace'
    if "`list'"!="" {
        di as result _n "list(`list')"
    set linesize 255
	list `varlist' `if' `in', subvarname clean noobs abbreviate(33) `label'
    qui log close

-----Original Message-----
From: E. Michael Foster []
Sent: 04 November 2004 16:36
Subject: st: stata to winbugs

  Does anyone have a handy-dandy do file for exporting STATA data into a
format WinBugs can read? 

E. Michael Foster
Professor of Health Policy and of Demography
Methodology Center and Department of Health Policy
Penn State

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index