Data and Instructions: R, SAS, SAS University Edition, SPSS, STATA

by Janet L. Peacock, Sally M. Kerry, Raymond R. Balise authors of Presenting Medical Statistics from Proposal to Publication

An image of the cover

Don't you hate it when you see an analysis, table or graphic that would be perfect for your paper but you don't know how to make it? This website provides the instructions so you can replicate and expand the tables and graphics in Presenting Medical Statistics from Proposal to Publication (PMSPP) to support your own work.

How to Use this Site

When you see something useful in PMSPP you can jump directly to the instructions to make it by clicking the Code and Output link above. Don't panic if you don't know the "programming languages." On this page are links to introductions which give you a gentle introduction to the analysis software packages.

The "coding" languages (R, SAS and STATA) share a few things in common. First, they contain both cryptic instructions for the computer to follow and "comments" for humans to read to help explain what the code is doing. The code on this site has a LOT of comments. So, don't panic when you look at the code and you see a huge amount of text. Something like 90% of the text is just explanation.

The "syntax" to indicate comments is slightly different across the languages. The SAS code shows comments as green text that begin with a * and end with a ; or begin with a /* and end with */. R and STATA use other odd character combinations to indicate that the rest of the line is a comment. In the R code you will see # followed by gray/green text. In STATA you will see /// followed by green text. Read those clues but you don't need to type them. They are just there to help you understand the instructions.

The second thing that all the languages have in common is that they are unforgiving when you make typos. There is no spell checker and punctuation marks like comma and semi-colons need to be included or the code will generate an error. To make your life easier the code on this site is shown in color pictures (to match your experience using the software) and as text that you can copy, paste and modify. Copy and paste is your friend.

What Software Should I Use? Life Saving Advice

Because programming languages are not forgiving when you make typos you want to use whatever tool your colleagues are using. Every analyst has had the experience of beating on code for 20 or 30 minutes only to hang their head when their colleague looks at the code for 10 seconds and fixes it by adding a punctuation mark. As you are starting, work with friends and colleagues. Treat doing analyses like SCUBA diving. Don't go out alone.