Rodney Sparapani's SAS Macros for BUGS

Several people have asked me to combine my work with Matt's, so I've created this web page for one-stop shopping. I wrote an introductory article to these SAS macros for the ISBA Bulletin and you can find a revised version called tr049.pdf which you can also find in the download below.

I've made some minor improvements to Matt's SAS macros. There is now a single version for BUGS and WinBUGS. If you have questions or problems with these, then please email me rather than Matt.

NOTE: These two SAS macros and the revised article are in the bundle below, so you only have to grab one file to get them all.

CODA2SAS: Converting CODA files to a SAS dataset

SAS2CODA: Converting a SAS dataset to CODA files

And, I've re-packaged my own SAS macros which handle things that Matt's don't like multiple chains, more statistics/tests, exporting "list"/"structure" data files from SAS datasets and importing "list" data files into SAS datasets. There are 35 SAS macros, but you needn't concern yourself with most of them. The SAS macros that you will actually use are the two above and the five below:

_DECODA: Converting CODA files to a SAS dataset

_LEXPORT: Export a SAS dataset to a "list" data file

_SEXPORT: Export a SAS dataset to a "structure" data file

_LIMPORT: Import a "list" data file to a SAS dataset

_CEXPORT: Export a SAS dataset to a CSV/Stata data file

ZIP package of SAS macros

NOTE: Documentation now exists for all of my SAS macros. A brief description followed by an explanation of the parameters can be found in each SAS macro file after the GPL. Also, _LEXPORT and _SEXPORT now support R/S+ and JAGS as well as BUGS.

Quick and Dirty Installation instructions
For more complete and advanced instructions go here

To install these SAS macros, do as follows:
1. unzip them into a directory denoted by ?????? (use the actual name)
2. edit your SAS configuration file, sasv8.cfg, sasv9.cfg (Windows) or sasv9_local.cfg (Unix/Linux)

2a. you probably have a line something like the following:

-sasautos '!SASROOT/sasautos' /* for Unix/Linux */

-sasautos '!SASROOT\core\sasmacro' /* for Windows */

2b. edit or add the corresponding line as follows:

-sasautos ( '!SASROOT/sasautos' '??????' ) /* for Unix/Linux */

-sasautos ( '!SASROOT\core\sasmacro' '??????' ) /* for Windows */

3. now, call the SAS macros from your SAS program like:
%_decoda(out=dataset, chains=2, infile=coda);
%_limport(infile=alc.tbl, file=import.sas, out=alc);
%_lexport(file=alc.txt, data=alc, var=status alcgrams);
%_sexport(data=matrix, var=col1-col5, file=m.struct);

Rodney's contact info

Matt Hayat's SAS Macros for BUGS

BUGtoSAS: Converting BUGS output files to a SAS dataset
Documentation (MSWord)
SAS macro (BUGS Version)
SAS macro (WinBUGS Version)
Note: Requires having the same number of samples for each parameter.
SAStoCODA: Converting a SAS dataset to CODA input files
Documentation (MSWord)
SAS macro

Matt's contact info