I have been trying to get ready for two workshops this summer. One is called Visual Data with SPSS (pretty obvious what it is about). The second one is statistics using SAS Enterprise Guide. I was going to call the first course Statistics without Numbers and the second one Statistics without Programming. A colleague pointed out that what students want is not statistics without programming but statistics without pain. I never quite see statistics as painful in the same way that some students do, but I conceded his point and so that is now the official name on the schedule.

It will, in fact, be a course without programming because I have spent half the weekend so far beating the data into shape. Unfortunately, this is going to be a bit misleading for students because in real life data don’t come nicely packaged. There are a couple of things that I have not found a way to do in SAS, SPSS or Stata using a point-and-click (GUI) interface.

Chief among these is array processing. Say, for example, I want to recode all 90 questions on a survey to have both -1 and 8 as missing values. The closest you can do this is in SPSS with the TRANSFORM > RECODE menu options and it does remember the previous values you entered for old and new values. Still, it’s much quicker to just write the syntax for it. Same with Stata and SAS. If there’s a way to do it quickly, I have yet to discover it.

One idea I stole from Dreamweaver is snippets, little bits of code you store to do specific little tasks, like create a form button. Probably the most common “snippet” I use in SAS is the array/ do – loop

data in.visualdata ;
set in.visual ;
array redo{*} _numeric_ ;
array nxt{*} q1 — q920a ;
Do i = 1 to dim(redo) ;
if redo{i} = -1 then redo{i} = . ;
end ;
Do j = 1 to dim(nxt) ;
if nxt{j} = 8 then nxt{j} = . ;
end ;

Above, the data used -1 for missing data for all of the numeric variables, so it was easy enough to take care of that. However, for some questions, 8 was coded “no opinion/ don’t know” so I wanted that to be missing also, but for other questions 8 was a valid value. So, I needed two array statements and two do-loops.

I did not see any way to do this without programming other than 90+ pointy-clicky things. Not.

I have similar “snippets” that do the exact same thing for Stata and SPSS.

Another disappointment in Enterprise Guide in particular is the lack of a convenient where clause. I would like to only analyze cases where the respondent selected Obama or McCain as the likely candidate in the election. I could easily use the QUERY feature in SAS EG , create a computed column, recode into a new column called vote2008 and now have three values, missing, Obama and McCain. However, if I wanted results only on those who had selected Obama or McCain I would have to use the Filter & Sort feature and create a new dataset, I thought perhaps there was a WHERE clause and I had missed it.

So, I googled “SAS Enterprise Guide” WHERE clause and was linked to a post that ironically mentioned my blog saying that I can’t see a lot of experienced programmers switching to Enterprise Guide. [In an aside here, I should mention I did not get as much hate mail as from the R people, just some snippy comments from the SAS EG folks about how I am "old". Having survived the adolescence of three daughters and a fourth now on the brink I have developed immunity to all such comments . Moo ha ha <---- Evil scientist laugh, in case you didn't recognize it.]

Eva, Supergenius Baby

Eva, Supergenius Baby

Besides, when you’re old, you get to have grandchildren as compensation. So, it’s all good.

In the comments on the blog that commented on my blog (are you lost yet?) was a discussion of the disappointing absence of the WHERE clause.

I overcame this disappointment quickly because SPSS actually does have something like what I wanted. Go to the DATA menu and choose SELECT CASES, throw in an IF clause and you have the dataset you want to analyze. Then, when you go to the next analysis, you can select different cases if your little heart desires. In another, fleeting, disappointment, SAS Enterprise Guide does not seem to have an option to export to SPSS (or Stata, for that matter), although SAS 9.2 does export to both SPSS and Stata (and about damn time, too). No big deal. I exported it to Excel which will pop open in SPSS no problem.

In yet another disappointment (is the title of this post not “Life is full of disappointments”?”) I could not find a way to make SAS EG do the graph I wanted which was the mean income of people who voted for McCain and people who voted for Obama. The bar chart options kept giving me percentage, cumulative percentage, frequency and cumulative frequency as the only options. Yes, I KNOW I could code it in PROC GCHART but have you ever actually written anything in SAS/Graph? Yuck! It reminds me of when I used to have to write things using Tell-A-Graf to produce plots on our plotters at General Dynamics. (And if you remember any of that, you really ARE old!)

Of course, the course IS entitled Visual Data with SPSS and I was only cleaning up the dataset in SAS EG because it happened to be open.

In the final disappointment that has been going on for a while, actually, I haven’t been able to read in the formats with a .stc file from ICPSR. I contacted them and they suggested running with options nofmterr . This is one of those pieces of advice like yelling “Run faster!” to a runner in a race. It is correct but not really very helpful. My problem is that I wanted to have the formats created so I could use them. Usually ICPSR provides you code in SAS, SPSS or Stata with the formats/ data labels. Not this time. Oh well, that is something helpful, young assistant can do on Monday. Thankfully I will only be using 16 of the bazillion variables.

Anyway, I am over all of it. Tomorrow, after judo practice, I am going to the Renaissance Faire for Mother’s Day. We are going tomorrow because, for the umpteenth year in a row I will be out of town on Mother’s Day. This time, though, it is NOT for work but to watch my next-to-youngest baby compete in Tunisia. Some people, like those that watched her winning this final at the Valentine’s Day Massacre, say she is not such a baby, but she still is to me.

So, yeah, my software isn’t perfect but the weather is lovely and my kids are pretty good. As for my husband, he just brought me up a glass of Chardonnay and it is time to kick back, drink it and read the New York Times (yes, even though I live in LA, I read both papers every day).

Just read a tweet from some young starlet saying,
“You don’t marry someone because you can live with them, but because you can’t live without them.”

And my thought was,
“Honey, you are obviously single. (And put some more clothes on, too.)”
Yes. I AM old.

So, despite the disappointments, I guess I will survive to teach the summer workshops. Who knows, I may even get time to go to the beach.
beachbahamasjpg

Comments

4 Responses to “Life is Full of Disappointments”

  1. Jon Peck on April 25th, 2010 8:17 pm

    Two thoughts.
    Be careful with SAS 9.2 SPSS export. If you export in Unicode (utf-8), SAS produces an invalid file, because it does not include the encoding in the SPSS file. SAS has apparently agreed that this is a bug, but I have no idea when it will get fixed.

    Second, for SPSS, consider making a few custom dialog boxes that you could give students. This is really easy to do, and you can put any syntax in it and have values substituted from the dialog controls. To get the most out of it, you can use Python programmability, but you can do a lot without that. Take a look, for example, at the dialog on DevCentral for generating a dataset of random numbers according to various distributions.

    Or you could make your own bulk recode dialog.

    Regards,
    Jon Peck

  2. admin on April 25th, 2010 9:50 pm

    Thanks for the suggestion on the custom dialogue boxes. I have given students “snippets” of code just because I am often crammed for time, so I say, “run this in the syntax window and then go ahead with your analysis”.

    A dialogue box would be better. So, on to my never-ending to-do list it goes.

    So far, I haven’t had any problem moving files back and forth between SAS 9.2, SPSS and Stata. It’s far better than using the SPSS engine with the Libname statement to read in .por (SPSS portable) files which is what you used to have to do. Thanks for the tip about unicode, though.

  3. Wendy on April 26th, 2010 7:29 pm

    Hi,
    Just wanted to tell you that I really enjoy reading your blogs. I’m a SAS programmer at Kaiser (in Oakland). Found a link to your blog and website on some SAS forum and have been checking back in periodically ever since. I really like your perspective on things – and your sense of humor. So, just a “thanks” note.
    Take care.
    -Wendy Leyden

  4. Kylie Batt on May 3rd, 2010 6:12 pm

    Я считаю, что Вы ошибаетесь. Пишите мне в PM, обсудим….

    I was going to call the first course Statistics without Numbers and the second one Statistics without Programming. A colleague pointed […….

Leave a Reply