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.
David
[email protected]
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
end
-----Original Message-----
From: E. Michael Foster [mailto:[email protected]]
Sent: 04 November 2004 16:36
To: [email protected]
Subject: st: stata to winbugs
Hi,
Does anyone have a handy-dandy do file for exporting STATA data into a
format WinBugs can read?
thanks,
Michael
E. Michael Foster
Professor of Health Policy and of Demography
Methodology Center and Department of Health Policy
Penn State
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/