Michael -
I do have a rudimentary program for writing out all observations of a
variable with commas as separators and putting as many on a line as you
desire - so you can then paste this into a bugs .odc page. Of course you are
responsible for sorting the data in the approriate order.
Here it is: The first argument is the variable name; the second ones is the
number of observations per line of output.
version 7.0
/* bugwrite.do - writes stat variable `y' in bugs format with `k'
values per row */
args y k
local N=_N
if mod(`N',`k')==0 {local r = `N'/`k'}
if mod(`N',`k')>0 {local r =1+int(`N'/`k') }
forv i=1(1)`r'{
local i1=1+`k'*(`i'-1)
local i2=`k'*`i'
if `i2' > `N' { local i2=`N'}
local a ""
forv j=`i1'(1)`i2' {
if `j' < `N' {
local a="`a'"+ string(`y'[`j'])+","
}
if `j' == `N' {
local a="`a'"+ string(`y'[`j'])+")"
}
}
noi di "`a'
}
Hopefully, this can be of some use.
Al Feiveson
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of E. Michael
Foster
Sent: Thursday, November 04, 2004 10:36 AM
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/