Jun

9

I decided I need to learn a new language. I had learned a number of languages in the past but SAS is the only one I used on a daily basis. I write SPSS syntax about every other day (does that count?). I toyed with Ruby and C++.  I listened, bemusedly, to people who exhorted me to learn R. In the end, I settled on Javascript and we are having a good relationship.

My choice was based on needing something that was better at stuff SAS isn’t very good at. I needed something that would create dynamic web pages, was easy for user interaction. Also, I think it is good to get out of your comfort zone from time to time. Now js and I are on an initials basis. There are a few ways that I still frequently get thrown off, though.

Arrays subscripts.

In SAS, to refer to the ith value in an array named bob, I use bob{i}

In javascript, you’d use  bob[i]

I have had to delete the curly brackets and replace them with square ones approximately 40 zillion times

Also, arrays begin with 0 in javascript and 1 with SAS. So, every index value is one less in js. The third element of bob is bob[2]

For some reason, that was far easier for me to adapt to than the bracket difference. A reasonable person might say this is wrong and argue that counting starts at one.

house with candy on roof

I went back to apples. If you are counting apples, you start at 1. If you are measuring distance, you start at zero. When you start to go somewhere you are not 1 mile or 1 foot or one anything from your house. You are at point zero.

Javascript = house

red apple

SAS = apple

 

DO loops – in a good way

Another way javascript is different is do loops.

Take this  example of how you would do a loop in SAS:

DO i = 1 to DIM(bob) ;

some programming stuff ;

END ;

Then, at the end of your program, you need to delete i or it sticks around forever. In javascript, you do this;

for (i=0; i < facts.length ; i++) {

some programming stuff

}

Because you set the counter to 0 at the beginning, you can re-use the same counter variable over and over in your program. Of course, you could re-do this in SAS by re-setting i to 1 after every DO loop but that takes an extra statement. I usually just use different variable names – i,j, k – and drop them all in the DROP statement at the end of my program.

The moral of the day is, if you are a SAS programmer and are interested in picking up a new language, there are certainly worse choices than javascript. Much of what you are comfortable with from SAS will transfer. However, there are the odd differences, some of which, like the different type of brackets for arrays, which will make your life difficult and others, like the for style for DO loops that can make your life easier.

I have more to say about SAS and javascript and why I chose javascript but for now, I need to write a post on why Codecademy is not the way to learn to code.

 

**** Thank you to @stat_geek on twitter who tweeted that you could also use [] in SAS and they would work. My point is that I have always used {} and have never used the square brackets and old habits are hard to break. Tomorrow I am going to have to change some of my SAS programs to use [] just so I can be one of the cool kids.

Jun

6

I looked on my calendar and there was a reminder that a month from now I will be in Nova Scotia. I try to get in my travel to anywhere north of Santa Barbara between May and October due to a near-fatal allergy to cold weather. I’m looking forward to this trip, for a few reasons. One is that I haven’t been to Nova Scotia in almost thirty years and it really is beautiful, when you can find it under the snow.  A second is that I have family there I have similarly not seen in almost 30 years. They generally go down to the Caribbean in the winter to visit the smarter branch of the relatives who refused to move from tropical islands because, well, isn’t it obvious. Then, there is the whole propensity score matching thing, which is kind of cool and fun.

Nova Scotia

Propensity Score Matching

…. as will be explained by me, somewhere in Nova Scotia.

While random assignment to groups is just the thing to make a statistician’s heart beat faster, many statistical problems involve comparisons of groups that were different before the independent variable had any effect.
Think about some of these comparisons:

The challenge for the statistician is to control for all of the pre-existing differences between groups when testing the effect of the intervention.

Propensity score matching is an increasingly popular method of meeting this challenge. The concept of propensity scores is not that difficult. You have two groups- they can be any two groups but the key point is this – they were not randomly assigned and they are not equivalent. Three methods of propensity score matching with SAS will be discussed in this paper; quintiles, nearest neighbor and calipers. All three methods begin with PROC LOGISTIC to obtain a propensity score. Quintiles, the simplest method, sorts these into quintiles using PROC UNIVARIATE, and matches scores from the same quintile. The nearest neighbor and caliper methods both make use of SAS macros.

For even greater excitement, SAS code will be provided.

(I was told that if I provided the SAS code, the Nova Scotians would provide the beer.)

I have no further details at this time other than the promise of beer, SAS and propensity scores. That was enough to get me to book a flight to Nova Scotia. Seriously, there’s no need to get anal-retentive about it, I mean, what more do you want?

Jun

3

At SAS Global Forum, someone commented to me that he was stunned at the number of people who were unfamiliar with a c:\

Yes, young people, when us oldsters say “c prompt” we are not talking about a cool shellfish

king crab

Nope, my dears, in Windows, we expect you to go to that window start menu, click on All Programs, then pick Accessories and then there is something called a Command Prompt.

Don’t feel bad if you don’t remember it. I barely remember it myself.  I use SAS On-Demand a lot with my classes. I have a pretty awesome new computer so even with very large data sets I can run things pretty quickly just by clicking on that little running guy.

BUT … every now and then I end up with a job  that not only takes a long time but fills up the entire output buffer. I don’t want to clear my log file. I want to read it later.  So.. enter batch SAS

It’s very simple if you remember a few things.

1. Go to the directory where your SAS program is located. To do this, you most likely need to change directory from the top-level C:\   To do that, say your file is in a directory called MySASFiles in your documents folder, do this:

cd \users\you\documents\MySASFiles

obviously, you want to put your name instead of  “you”.

Unlike Unix, Window is not case-sensitive

2. Remember that if you have a space in the directory name you need quotes and, unfortunately, SAS is almost certainly stored in the Program Files directory. Also, remember to end the quote at the end of the whole path, that is, at the end of your file name, so you are going to write the whole statement on one line (don’t worry if it wraps around by itself) like this

“c:\Program Files\SAS\SASFoundation\9.2\sas.exe” -sysin programname.sas -config “c:\Program Files\SAS\SASFoundation\9.2\sasv9.cfg”

With the -sysin and -config, make sure you have no space between the – and the word that follows.

Then hit enter. The log and lst files will automatically be named programname.log and programname.lst and be created in the directory where your programname.sas file is.

That’s it. Go have a martini. Come back when you are sober and look at your results.

Jun

2

Since I was a female engineer over thirty years ago, I’ve seen quite a bit of change for women in technology. Still, both then and now, a common complaint is about how women are held back by lack of mentors. Now, being on the other side of the desk, I can see one possible reason why.

I started working as an engineer in my early twenties and, coincidentally, got divorced shortly thereafter. So, here I was, a young, single woman working almost exclusively with older men. Some, such as the lead engineers on the projects I worked on, tended to be around ten years older than me, while the men in upper management were usually two or three times my age.

If one of them offered to have lunch with me, stayed after a meeting to give a more in-depth answer to a question I had or invited me to have a drink after work with the group, there was always that little bit of wondering if they had some other motive in mind.

As I got MUCH older, I didn’t have to worry so much that the guy telling me about the cool macro he did to compute power analysis for mixed models was interested in anything other than my opinion. Maybe I am naive, not being very experienced in the affair-having business, but I suspect that those types are more likely to be hitting on people my daughters’ age than mine.

Recently, though, I’ve had a few experiences that made me understand better how the male managers might have sometimes felt around people like me. Often, when I see a young person giving a presentation or struggling with a technical problem, I’ll try to help. My own three older daughters are aged 25 to 29, so I tend to associate young people with them, and I would hope people in their fields would lend them a hand as well.

I try to encourage doctoral students to present, publish and apply for positions that they may see as a stretch but I think they can manage. When I was their age, I was fortunate to get that kind of mentoring and I try to give back.

Every now and then, I get a bit of a strange look from young men, like, “What’s in it for you?”

Maybe they’ve been watching that TV show Cougarville, too much. I don’t know, but it’s not just my imagination. A colleague told me when she offered to help out a younger, female colleague the young woman hinted that she thought it bordered on sexual harassment. My colleague responded in a rather explicit manner that detailed her sexual proclivities not involving women.

My point, which you have certainly by now despaired of me having, is that, partly, the reluctance for men to act as mentors to women is not sexism but rather a perfectly understandable desire not to be perceived as a creep or a dirty old man.

I have no answer for that, other than to say I get it now.

Jun

1

It occurred to me today that I could not remember ever meeting another Hispanic statistician and I got to wondering how many Hispanic statisticians there actually are. I started with Google, source of all knowledge. I found a blog post from two years ago that said there were 12 Hispanics out of 15,904 members of the American Statistical Association. Since I am, in fact, a card-carrying member of the ASA ever since four months ago, when I decided it was not your father’s statistical association any more, I thought I would go and see where those figures stand now.

There are a total of 43 records returned when you search the ASA Directory of Minority Statisticians for Hispanic and ASA members. Of those 43, one person is entered twice, two are students, two have addresses outside the United States and one entry has no name listed. Even if we include no-name and the students that leaves us with 40 people. The ASA now has over 18,000 members.

Not to be a snob, but I did not consider people with a bachelor’s degree or still in school to be statisticians. More like statisticians-in-training. So, I refined my search to include only American Statistical Association members with a Ph.D.  There were 17 Hispanics.

Perhaps it is because you have to actually register for the ASA Directory of Minority Statisticians, a fact I was not aware of until today. You aren’t automatically entered just because you checked Hispanic (or anything else) on your membership form. If you have a mad desire to be in the directory you can register here.

So …. are there a whole bunch of Hispanic statisticians out there and they’re just in hiding?

Hidden Statistician

It occurred to me that I have attended numerous statistical conferences and met very, very few Hispanic statisticians.

I met two people who may or may not have been Hispanic. They had Hispanic-sounding surnames but neither of them looked Hispanic (yes, I know, I have watched Telemundo, too. There are plenty of blonde Hispanics. There are also black Hispanics but you don’t see them on TV much.) I didn’t hear either of them speak Spanish, either, not even one word, and that is kind of the secret handshake of Hispanics. You might wonder why I didn’t just ask them, but at the time we were talking about things like mixed models, clustered sampling and parallel processing. I didn’t think about it.

Here are the people at the statistics conferences I attended over the past decade who I knew were Hispanic

 

No wonder I’m lonely at these meetings! How about you? Are you a Hispanic statistician in hiding?

« go back

Blogroll

WP Themes