The downward mobility of Ph.D. students is like domestic violence in many ways. That is, the people in the “family” all know it is a fact of life, but they don’t talk about it among themselves, and to outsiders they pretend it doesn’t exist. The fact is, far more people will graduate from Harvard than job openings exist at Harvard. They will, if they are lucky, go to the next tier – the New York University, Washington University in St. Louis, University of Chicago, Emory, Vanderbilt – the schools that bill themselves as “The Harvard of X”. You know, Harvard of the Midwest, South, eastern Detroit, whatever.

The graduates of the Harvards of X will go teach at the better state universities and private liberal arts schools. The graduates of THOSE schools will teach at less prestigious institutions and so on. It’s turtles all the way down.

So, you learned SAS at the program where you received your masters or Ph.D. and now here you are at Budget University that does not use SAS because even at the huge discount given to academic institutions your school cannot afford it short of having the Vice-president for Business Affairs sell his one remaining kidney (he had to give one kidney up to afford the budget for journals for the library after the Research Works Act passed).

If you have been reading my blog regularly (what?! you haven’t?) you know a few things about SAS On-Demand besides the very most important thing, which is that it is FREE.

 

1. I am going to assume that you, the professor, or the low-paid, overworked teaching assistant, know a decent amount about SAS. You know how to code a data step, have a clue what a format is, and feel comfortable around if statements. You may not be the greatest programmer in the world, because after all, you are teaching statistics in the Education, Psychology, Sociology, Biology or whatever it is department. Still, you can hold your own.

2. Your students know nothing about SAS and they don’t particularly want to learn it. They don’t want to learn statistics either, most of them, but the university is making them.

3. Let’s assume you read my previous amazing blogs on getting a SAS on-demand account, uploading your data to SAS on demand and importing .stc. files.

4. Before this next step you probably want to go to TOOLS > OPTIONS > RESULTS GENERAL and click off the option for SAS Report and click on the option for HTML as output. This is convenient because when you see a nice graph you would like to include in your powerpoint, class blog or whatever, you can just right-click on it and export it as a .png file.

5. 4. We have already assumed that you took your rocking SAS knowledge to a university that does not have a SAS license. You can write any program you like and run it. Here is one below that was written assuming you want to use SAS On-demand to create a file for your class and you need to do everything in SAS On-Demand. You are going to run a program to import the data, select the variables you want and store the formats in a data set. This creates a nice analytic dataset.  Because you are a conscientious professor, you are going to check the data after running the program using the CHARACTERIZE DATA task.

7. Not only does the CHARACTERIZE DATA task give you a check that your data are as you expect, but now you have some nice charts to begin your first day of class.

8. You can start your first day with telling the students about the data set you are going to use.

 

libname mydata "/courses/u_2.edu1/i_123/c_2469/saslib" ;
options nofmterr ;
Filename readit "/courses/u_2.edu1/i_123/c_2469/saslib/04219-0001-data.stc" ;
proc cimport infile = readit library = work ISFILEUTF8=TRUE ;


proc format ;
value alc
3 = "1-2"
2 = "3-5"
1 = "6+" ;


data work.alcohol ;
set work.DA4219P1 ;
if alcopyr = 0 or alcohol = 0 then amntalc = 0 ;
format amntalc alc. ;

attrib b length = $10. c1dthyr length = 8.0 c2dthyr length = 8.0;
death = input(compress(dthdate),mmddyy10. ) ;
b = “01/” || compress(brthmo) || “/” || compress(brthyr) ;
bd = compress(b) ;
brthdate = input(b,mmddyy10.) ;
lifespan = (death – brthdate) / 365.25 ;
lifespan = round(lifespan,1) ;
if alcopyr = 1 then alcopyr = . ;
if smcigars = 1 then smcigars = . ;
if educ in (3,4,5) then education = 4 ;
else education = educ ;


if cohort = 1 then do ;
if death = . then c1dthyr = 12 ;
else c1dthyr = Year(death) - 1971 ;
yrslived = c1dthyr ;
dthy1 = year(death) ;
end ;


else if cohort = 2 then do;
if death = . then c2dthyr = 12 ;
else c2dthyr = Year(death) - 1980 ;
yrslived = c2dthyr ;
dthy2 = year(death) ;
end ;


drop b bd F_A_X01 -- I_AUTPSY MR1_CS1 -- A_F_DT1 D_A_DT2 -- H_DISDT4 MRCSDT1 -- MR3_DT4 IREVMVA -- NTIS5 LABsum1 -- E_MRDX Vis1y1 -- vis9y9  E_CR1 -- PRCS43  B_INTR -- MRCSDDT23 ;

That is what YOU are going to do. What you are going to have your students do is

A. Log into their SAS on-demand account
B. open the itty-bitty Exercise1.egp file you send them in your email or upload to your course website on Blackboard, Sakai or whatever you use

This is what they will see:

Process flow with one program, two datasets, characterize data task & output
C. Click on the RUN button and select RUN PROJECT

Magic! They will have results and your discussion of the data and statistics can begin!

Tomorrow and the next day I will give an explanation line by line of that program, just in case your SAS knowledge is not so rocking, and show some really cool charts that were produced and could be used to start a discussion your first day of class.

That is, if  “tomorrow and the next day” are defined as whenever I get around to it in the next week or so.

I have been doing the Codecademy javascript lessons, along with 200,000 other people who joined up for Codeyear , resolving to complete a lesson a week and learn to code javascript better. So far, the lessons have been pretty easy.

Inspired by Sheila Tobias’ research (see her book, They’re not dumb, they’re different ) suggesting that non-science majors would succeed in science more given the right kinds of encouragement, let me offer some unsolicited advice to some of those 200,000 people, about half of whom are probably thinking of giving up on their New Year’s resolution already.

I just said the lessons were pretty easy. Actually, I was hoping they would get more difficult soon. Even more discouraging to you, I expect to finish the Codeyear lessons in three months or less. I was planning on doing it in January but I really won’t have the time. How the hell was that encouraging?

BUT … I found it easy because I have programmed in one language or another since my first Fortran class in (I think) 1977. A long time ago, anyway.  I am already very familiar with the concept of loops, Do-While, IF then/ else, object-oriented programming, function, objects, properties and methods, to name a few. The FIRST time I had to write a program using an object-oriented language, I found it very difficult and confusing.

snowflakes

Snowflake, Creative Commons license

So, if this is your first time, you’re not only not dumb, you’re not even very different, despite what your mama told you about us all being unique and special like a snowflake. The less previous knowledge you come with, the harder it is going to be to learn your FIRST language. That’s the bad news. The good news is that each one you learn after that gets easier. The more you learn, the easier it gets.

Another thing I’ve done to learn javascript is to read Jeanine Meyer’s book The Essential Guide to HTML5. As with many other ostensibly beginner books that start out, “No previous programming experience is required”, I am constantly marveling at how much harder this book would be to understand if you didn’t have any previous experience. Read it. Read over any chapter you don’t understand. Read another book.

 

Other things I’ve done lately to learn javascript better:

Modified several of the games in Meyer’s book to shoot buffalo in various forms to amuse my odd friends.

http://www.thejuliagroup.com/games/shootbuffalo1.html

http://www.thejuliagroup.com/games/shootbuffalo2.html

Enabled the Develop menu on Safari. (Click on this link to see where the Develop window is cleverly hidden.) This is extremely useful and already on your computer if you use Safari. Definitely check it out.

As well as the Codecademy site, I use textwrangler for coding on my Mac and notepad++ in boot camp. Yes, I know there are probably better packages out there but these were two that were already installed.

Notice, these are steps you won’t need to take the next time you are trying to learn a language, or learn a language you know better. You’ll have the Develop window enabled. You’ll have some text editor you like installed .

Read Javascript 24-hour trainer, by Jeremy McPeak and played the videos on the accompanying DVD,

Watched random “learn javascript” videos on youtube.

Poked around on a javascript forum just to see what people are talking about.

Here is a really big piece of advice, based on what I read of Tobias’ studies of science and non-science majors:

Non-science majors, she found, were frustrated because they wanted to see “The Big Picture”, how all of this fit together. It would seem like a waste of time to them that they were writing a function to concatenate first and last name. What’s the point? The science majors, on the other hand, accepted that you had to learn a lot of “boring stuff” before they got to the really fun, creative part of science.  

How could you ask and answer really interesting questions without a basis of knowledge,

said the science majors.

I want to know why I’m doing this stuff, and not be a mindless drone,

said the non-science people.

Here are my encouraging words …. once you’ve done some programming in one language, it is immediately obvious to you why you want to be able to write a function, loop, etc. A huge advantage that people like me have in learning a new language is that we know that we’ll figure out at some point the prototype object, concept of inheritance. We accept and even expect to go through a lot of silly games to make a buffalo fall over dead before we get to do the really useful stuff.

Zebra family

Thanks to Free Photo Bank for the zebras

Free photo bank.

Fine for me, you say, but you’re not me. You’re special like a snowflake and you want something different. Then maybe, in addition to the Codecademy course you may want to pick up a book to do whatever it is that you want to do – database, games, social network – start looking at those programs. Try  to write one. Of course it won’t work, what are you nuts, you just started.

However, as you work through THAT program and the Codecademy lessons simultaneously you will see more and more where the function, properties and methods fit into the program you’re writing for a social network site for Zebra lovers. Maybe when you get done, you’ll have both an understanding of javascript and your zebra site.

Another blog post on Codeyear can be found here, on Matt Waite’s blog. His main bit of advice – turn off everything else and focus when you are doing the lessons. I second that.

DISCLAIMER blah blah blah – It has been pointed out to me that bloggers should reveal their conflicts of interest. Are you fucking kidding me? I post things on this blog like how I would like to bitch-slap a couple of money-whore congressional representatives over their support of the Orwellian-named Research Works Act. Do you seriously think people PAY to have their products featured on a blog written by as, one commenter put it, “The foul-mouthed stats lady?” I am sure corporations consider paying me NOT to mention them,

“Hey, don’t do us any favors, all right?”

All opinions are my own. Several of the opinions you have are probably mine, too. Give them back.

I am pissed.

As a small business owner, I am feeling very, very disappointed that there is certainly some law out there that would impose penalties if I drove on over to Riverside County and bitch-slapped Darrell Issa. I’ve grown cynical enough in my old age and after having run a small business since 1985 that I am used to every politician under the sun spouting “Think of small business!” as a knee-jerk reaction to anything, whether their position is for it or against it. Usually, they are easy enough to ignore. Payroll taxes are not going to decide whether or not I hire people – business demand is. Health care – we’ve made that an option for our employees long before it was required by law.

This time, though, they are REALLY pissing me off. Let me tell you what the Research Works Act is and how it really does hurt my small business. As this succinct article by Janet Stemwedel on the Scientific American blog site explains well, not only does it require the American taxpayer (that’s me!) to pay twice for the same research, but also, the very people being protected and profiting are NOT those who produce the work to begin with.

Right now, if a person is funded by federal funds, say, the National Institutes of Health, they are required to submit the results of their research to PubMed’s repository within twelve months of publication. The idea is that if the public paid for this research then the public has the right to read it. Sounds fair, right?

In case you don’t know, rarely do authors get paid by journals.  I’ve published articles in the American Journal on Mental Retardation, Research in Developmental Disabilities, Educational and Psychological Measurement – to name a few. I’ve been a peer reviewer for Family Relations. For none of this did I get paid. That was fine. Almost all of the research I did was funded by federal funds and part of the grant proposals included dissemination – that is, publication of scientific articles. Fair enough. As a peer reviewer, I’m just repaying the service others have done in reviewing my work. Again, no problem.

Yet, in many cases, if I need a journal article for a grant or report I’m writing for a client, it is going to cost me $30 per article.  Contract research is a good bit of where the actual money comes into this company (you didn’t seriously think I made my living by drinking Chardonnay, spouting wanton programming advice and snarky comments, did you?)

The journal did not pay for the research to be conducted – the federal government did. The journal did not pay the author – the federal government did. The journal did not pay the reviewer – they volunteer.

SO WHY THE FUCK SHOULD I PAY $30 AN ARTICLE?

I just pulled up a random small project I had done recently for a client and there were seven articles in there that I would be charged $210 to have used. As I said, this was a small project, and I calculated it would have brought the price up 7.5%

Not long ago, there was a huge outcry about the city of Santa Monica adding a ten cent cost for a paper bag and banning plastic bags. “It will hurt small business!” people cried. Actually, I have always made a major effort to shop at our local businesses, I still do and it has not hurt any business anywhere that I can tell. You know what else I can tell you? That increasing the cost of a $3,000 project to $3,210 is a hell of a lot more significant than paying ten cents for a paper bag!

So what exactly is this bill doing? It is moving money from small businesses, like me,  and like my buddy, Dr. Jacob Flores, who runs Mobile Medicine Outreach and into the hands of large publishing companies, who not coincidentally gave a huge amount of money  to Democratic congresswoman Carolyn Maloney of New York. I’d like to bitch-slap her, too, but being on the opposite side of the country, it would be a lot less convenient for me.

You can read more detail in this article from the Atlantic, where Rebecca Rosen asks, “Why Is Open-Internet Champion Darrell Issa Supporting an Attack on Open Science? ”

As Danah Boyd points out on her blog, there is this new thing for sharing knowledge now, called the Internet and a major point of the Research Works Act seems to be to prevent it being used to share knowledge that I paid for with the approximately 50%  of my income (yeah 38% federal, 10% state) that I pay in taxes. And you know what, being a graduate from that great institution, the University of California, that enables me to make the money to pay these taxes, I don’t object to that.

What I DO object to is paying again for the same resources I already paid for once just because some lobbyists for large corporations lined Issa’s and Maloney’s pockets.

While it may not be legal for me to bitch-slap Issa it is certainly legal for me to go to the next California event where that lying-ass mother has the balls to stand up and claim to be helping California small business. Anyone who knows the next public event where he’ll be speaking, please hit me up.

One thing, though, I don’t think I’ll be going to any of his fundraisers. I think he’s gotten quite enough money from the publishing industry.

 

As I mentioned previously, this week’s posts have been inspired by John D. Cook who generously does ELEVEN twitter tip accounts, Monday through Friday.

Don’t get used to it, but since this is the beginning of the year, I thought I would start out all saintly and enthusiastic with some basic tips for people new to SAS On-Demand. Yes, I can see you are excited.

Julia in autopia

Yesterday, I gave an example of a table analysis using the Kaiser-Permanente study of the oldest old. If you are doing a table analysis with a file like this one that has hundreds of variables with enlightening names like FA3_0X1  , it will be a lot easier to use the drag and drop menus if you use the labels instead of variable names.

Window with drop down menu on variable names, show labels clicked

What you want to do is right-click in the pane that has the variable names. A drop-down menu will appear and SHOW NAMES will be clicked. Click on SHOW LABELS, right below it, and the variable labels will show up so you can see that AXDGF7 is something like “Drinks wine with prostitutes”.

(Disclaimer: In fact, the Kaiser-Permanente study of the Oldest Old did not ask patients how frequently they drank wine with prostitutes. Whether or not they should have is a different issue.)

Random tip #2: Finding your site number

Let’s say you are having a problem with SAS On-Demand and you want to contact SAS technical support. You go to fill out the form on line and one of the REQUIRED fields is your site number. Normally, you will find your site number in your SAS log. So, you run a program or task in SAS On-Demand and guess what, no site number.

So you can’t submit the form because you can’t find the site number and you can’t ask how to find the site number because you can’t submit the form.

Do this:

Open SAS On-Demand

Option A: Click on HELP>  About SAS Enterprise Guide

You should get a window that gives your site number, like 0060061234

You can also click on a link and get some more cool information about your configuration, if you are into that sort of thing, which it just so happens, I am.

Option B:

What if that doesn’t work? I haven’t had any problems with the Help menu with SAS On-Demand at Pepperdine but I did once work somewhere that did not have the help files installed for SAS because someone who only appeared to have been put on this earth by God specifically to annoy me, had decided it took up too much space (don’t even ask). So, I was wondering if there was a Plan B.  Why, yes, yes there is.

Go to File > New > Program

Type this:

%put %syssite ;

run;

Click on the green run button.

Look in the log that results and under

%put %syssite ;

You will see a number like 0060061234

That is your site number.

Now, wasn’t that exciting?

I’ve spent about 35 years messing around with computers based on the assumption that most discoveries are not preceded by “Eureka!” but rather,

“What the hell! May as well try it.”

Having my new computer pretty much dissolve in smoke (less than a month after I bought it!), I decided to continue my analyses of the Kaiser-Permanente data using SAS on demand . I had downloaded this as  a .stc file a while back, and used PROC CIMPORT to read it in, with all the formats, which I have mentioned before, is really, really easy to do.

I wondered what would happen if I uploaded the SAS dataset, you know, the .sas7bdat file  and the FORMATS catalog to the SAS On-demand server. Would it work?

Short answer – kind of.  SAS On-Demand is very forgiving when it comes to format errors. It appears to have the NOFMTERR option turned on by default. I’d leave it alone.  Look what happens when I do a simple table analysis. I get a table – sort of.

This table doesn’t use the formats.  No one reading it would know that 3 = “6+ drinks daily”. If it was just one format, I could use a PROC FORMAT and re-create it. No big deal.  There are hundreds of variables and thousands of lines of format code I’d have to write. My first thought of

“What the hell, I’ll just drag and drop the folder with the formats”

was a failure.In fact, despite the fact that Filezilla shows that my format folder was uploaded, it doesn’t actually show up in the SAS server at all.

Table on alcohol consumption with no formats

I suppose I could at this point go read some documentation or SAS user group papers – there is plenty out there –  on moving catalogs between systems. Seriously, where is the fun in that?

I still had the original .stc file lying around so I thought I would see if I could use PROC CIMPORT with SAS On demand.

I had read-only access to the SAS server because that is what the students have, and I wanted to replicate what a student could or could not do.

I uploaded the .stc file using Filezilla (nothing special about Filezilla, I just happen to like it).

When I looked in my the SAS library for my class, I did not see the file, even though all of the regular sas7bdat files showed up there, but I thought, what the hell, I’ll try the CIMPORT any way.

Then, I ran this code:

libname mydata "/courses/univ.edu1/i_432400/a_2469/saslib" access=readonly;
Filename readit "/courses/univ.edu1/i_432400/a_2469/saslib/04219-0001-data.stc" ;
proc cimport infile = readit library = work  ;

 

Where the part in the quotes in the LIBNAME statement is the library for my course on the SAS server.

and I got this error message:

ERROR: This transport file was created by an earlier release of SAS that did not record encoding.  If and only if you know this file was created from a SAS session running a UTF8 encoding, you may set the ISFILEUTF8 CIMPORT option to T (for TRUE) to tell us to proceed to import this file.  If it was not created by a UTF8 session, then you must import it in a session
encoding that is compatible with the session encoding that produced that file.

If and only if I know this file was created running a UTF8 encoding ? Are you kidding me? Despite all the best warnings from my mother not to touch things if you don’t know where they’ve been, I downloaded this off the Internet! It could have originally been encoded in Korean for all I know (it wouldn’t be the first time).

But then I said to myself,

Julia the computer gnome“Self, wait a minute here. If it is in fact UTF8 encoded and I say that is true, then it will work. And if it isn’t true, what’s the worst thing that could happen? A gnome with a candy-cane hat jumps out of my computer and slaps me? Not very damn likely.”

So, I added the option, ran the statement like this

proc cimport infile = readit library = work ISFILEUTF8=TRUE ;

My program ran, my  SAS log showed all the formats were output, when I ran analyses, my formats were there and used.

All was right with the world.

Just to make matters more complicated, let me throw in this  — if you had NOT made the library ACCESS = READONLY and tried to write to your class’s SAS library you would get a DIFFERENT error about the formats coming from a different system and it would not have worked.

My guess, and it is just a random guess, is that maybe the class library had formats that were inconsistent with the older ones being uploaded so there was a conflict, while, since the work library is just held in working memory, there was nothing there to be inconsistent with. I could like it up or Google it or something. But I didn’t.

Yes, it IS amazing that they give people with my level of maturity passwords to high performance computers. I find it hard to believe myself.

 

 

 

I have been inspired by John D. Cook who does 11 tip accounts on twitter, each updated with a new tip, Monday through Friday.  There is a Unix tool tip, an Algebra fact account, and nine others. How cool is that?

Not being nearly as cool as him, I decided I’d just throw out a random tip now and then, since statisticians like anything with the word “random” in it.

If you got all excited about programming by watching some show about programmers let me tell you two things that Hollywood omits when you see those shots of the programmer typing rapidly writing code at 3 a.m.

  1. They are up at 3 a.m. because they have been working on that program since 11 a.m. that morning and the reason they started working at 11 a.m. is that they were up working on it until 4 a.m. the previous day.
  2. Although they are typing rapidly now, there was an hour of pouring through their code and cursing trying to find the bug before that 30 second spate of typing was filmed.

Buffalo

 

Given those two facts, here are some tips to keep in mind when you begin programming, as illustrated in the little snippet below from a program I wrote to shoot buffalo because a friend of mine asked me could I write a program to shoot buffalo. I have unusual friends.

 

“Draw” your program to be symmetric. This may sound funny coming from someone who failed art in junior high school and aced multivariate statistics in graduate school. I DON’T mean to make your code in rainbow colors (although I may write about that some other time). What I mean is that every time you do something that has a beginning and an end, whether tags in html, a DATA step in SAS or, in javascript (as shown below) functions, loops and if / else statements, indent what goes in the middle.

// DRAW EVERYTHING IN THE ARRAY 
	function drawall() {
		ctx.clearRect(0,0,cwidth,cheight) ;
		var i ;
		for (i=0 ; i < everything.length ; i++) {
			var ob = everything[i]  ;
			if (ob[1]) {
				ctx.save() ;
				ctx.translate(ob[3],ob[4]) ;
				ctx.rotate(ob[2]) ;
				ctx.translate(-ob[3],-ob[4]) ;
				ob[0].draw() ;
				ctx.restore() ;
			}
			else {
				ob[0].draw() ;
			}
		}
	}

Use comments liberally. I have had friends tease me about how many comments I put into programs, but I think this is one area where, if in doubt, put it in. Remember Eagleson’s Law,

Any code of your own that you haven’t looked at for six or more months, might as well have been written by someone else.

Put in whatever comments will make sense to you six months from now.

I don’t know if Eagleson actually said this or if he even exists. You can find some pretty funny quotes about programming in wikiquote, though, if you are in the mood.

Steal stuff. My most useful tip when you are beginning, and when you have been programming for decades is to re-use any good code you can get your hands on. When I first started I thought that was cheating, that real programmers wrote every line themselves, starting with a blank page. Was I ever stupid!

The code above is from a book on javascript. I took a program that shot a cannon and changed it to be one that used a rifle to shoot a buffalo on a hill. When you hit the buffalo, it flips upside down and is dead. If you miss, the buffalo comes off the hill and runs at you. You get another chance to shoot it dead.

I am kind of thinking other people have friends who ask if they can borrow a cup of sugar or wear their shirt, but that is not the point. My point is that half of the program I shamelessly copied from someone else for the price of a book on HTML5 I got on sale for $20 at Barnes and Noble.

My first thought whenever writing a program in any language is what do I have lying around that does something similar to that. If I don’t have anything very close, well, you can find lots of things on the Internet.  There are even (I know this is hard to believe) these objects fashioned from paper known as “books” that have code in them. Books are like a Nook or Kindle except that they dry out better after you drop them in the bathtub. Or so I have heard.

 

Glass of whisky. Public DomainWhen I met my second husband, the entire contents of his kitchen cupboards was a carton of Marlboro cigarettes, a bottle of Jack Daniels and a loaded Magnum revolver. Despite that, he was extremely healthy. His reasoning was that he was a big, tough guy while viruses and bacteria were little bitty things, so the nicotine and alcohol killed them before they could get around to making him sick.

In my continuing saga of mucking about with open data, I’ve been looking at the Kaiser Permanente data from the study of the oldest old. I’m interested in testing out the claims of a friend of mine who recently turned 65. He says that he may as well keep up drinking 8 or 9 beers a night because it’s too late to quit now. He’s already too old to die young.

The original data set had over 40% of the data missing on this variable but I noticed that people who said they did not drink were not asked this question. So, I added a couple of IF statements that set the number of drinks per day to zero for people who said they did not drink. This left me with four categories.

Window on right of Summary Tables window with format optionLittle nifty note for if you are using SAS Enterprise Guide, and you want your data to be presented in the table according to the formatted values, rather than the unformatted values, look to the right of the task window for summary tables and you’ll see an option to sort by and in what order.

This was useful for me because the default is to sort by unformatted values and the unformatted values were

  • 0 = never,
  • 1 = 6 or more,
  • 2 = 3-5 drinks per day and
  • 3 = < 2 drinks per day.

The results can be seen in the table below. In fact, people who did not drink at all, at least in the past year, had the longest life span, at 85.4 years. People who drank two or fewer drinks per day had a life-expectancy of 84.8, those who had 3-5 alcoholic drinks per day lived an average of 81.9 years and those who drank six or more did have the lowest life span, a still pretty old 81.7 years.

It’s worth noting that almost 20% of respondents had no data for this question and they had the longest lifespan of all at 85.8 years. I don’t know what to make of that other than that possibly those who tell researchers it is none of their damned business how much they drink have less repressed anger and stress and consequently live longer.

Table showing average lifespan by number of drinks per day

 

Were these differences significant? My next analysis was to do an ANOVA with lifespan as the dependent variable and the four alcohol consumption groups as the independent. I dropped the people with missing data.

There was a significant difference (F = 19.55, p < .0001), however, keep in mind that this is a fairly large sample meaning that even relatively minor differences will be statistically significant. In fact, drinking only explained about 2% of the variance in lifespan, and that’s assuming that there aren’t any confounding factors like women drinking less and also having greater longevity.

Another nifty tip for SAS Enterprise Guide. If you would like to export a graph in a project, say, so that you could post it on your blog, all you need to do is right-click on that graph and select SAVE PICTURE AS

When we look at the box plot produced by the ANOVA, it’s evident that there is very little difference between the last two groups.

We knew that from the table of means above, anyway.  Perhaps more interesting is that fact that a Tukey post hoc test showed all groups to be significantly different from one another EXCEPT for the last two groups.

In other words, for my friend who drinks 8-9 beers a night to see any increase in life expectancy he would have to drop his alcohol consumption to less than 25% of his current level. Simply cutting it in half would not really yield him a significant benefit.

Of course, I do suggest that from time to time and his response is:

Look, you’re not my mother. If I have any need of a woman telling me what to do, I already get it fulfilled when I visit my mother three times every week. She’s  88 years old.

I wonder how much she drinks?

 

(Here is one place to check if you are seriously asking yourself,  “Do I drink too much?” because I can pretty much guarantee you that a blog fueled by Chardonnay is probably not the best place to answer that question.)

← Previous Page