I’m always a bit bemused when people refer to me as a “SAS expert”. I don’t think of myself as an expert at anything except, perhaps, bricolage, a word I am indebted to sascommunity.org for even being aware of its existence.

Merriam-Webster defines it as:

: construction (as of a sculpture or a structure of ideas) achieved by using whatever comes to hand; also : something constructed in this way
French, from bricoler to putter about

Often, I think there are probably much more elegant ways of doing things but mine gets done very quickly which my clients appreciate since they pay me by  the hour.

Christmas tree made from shopping carts

One example of bricolage that comes to mind is my frequent use of PROC SUMMARY for output as input.

Take this recent problem.

Bricolage #1

A researcher had three measurements on each subject. The dependent variable was the mean of these measures. They were all taken at the same time, so this wasn’t a repeated measures type of design.  All I needed was to get the mean. Data were entered like this.

ID Group  Measure

01 ooo1 .47

01 ooo1 .46

01 ooo1 .46

02 o001 .49

02 ooo1 .48

I could have created a couple of variables using the LAG function, but really, I found this to be much quicker.

PROC SORT data = myfile ;




VAR  measure ;

OUTPUT OUT = myfilefix / AUTONAME ;

DATA myfilefix ;

SET myfilefix ;



See what I mean about bricolage? I’m sure a real expert would have used some DROP option on the dataset in the PROC SUMMARY or something and not needed the DATA step to only keep the variables for ID, and the mean of the measure variable, and some other option to only compute the mean statistics but since this took me all of five minutes and it was not a large data set to worry about sorting and time taken by extra steps, I didn’t bother. The reason for including the group variable in the sort and proc summary as well as the id variable, even though it is obvious that the same individual will always be in the same group, is simply so the group variable was carried along and saved in the file output by PROC SUMMARY. I’m sure a real SAS expert would have a less kluge-y way of doing that, also.

Bricolage #2

The researcher had individual subject data in one file and the group data in another file. For example, a record of all students and a record of data for the classroom. We want to merge these two files. In this case, however, the student file had a student id variable and the class file had a classroom id. Fortunately, there were 10 students selected from each class, so that students with id numbers 1-10 were in class 1, id numbers 11 – 20 were in class number 2, and so on.

I could have done a PROC FORMAT or maybe a DO -loop. What I did was this”

class = INT((student – 1)/10) + 1 ;

If I use the SAS function INT take the integer part of  1/10 to 9/10   I get 0 and if I add 1 to that, I get class = 1.

What about student number 10? Well, he or she will end up with 10/10 = 1  , add a 1 and that student will be in group 2. Not correct.

If I subtract one from every student number, it works out and sorts them exactly correct. I’m sure a real expert would know some function that does exactly that, but hey, it was one line and gave me the exact results I wanted.

See what I mean? Bricolage.

I will concede that there are times when I am working with an enormous dataset when I need to do things as efficiently as possible, or when I am teaching and I need to show the exact “best” method .

There are other times, though, when I just slap something together and call it a day.

A friend of mine, also a consultant, who would definitely consider himself a SAS expert, said, disapprovingly,

“I would never do that.”

He went on to ask me if my clients were satisfied with the way I work.

I told him that sure, I have lots of the same clients for a decade or more. Often, with simple problems like the ones above, it takes me so little time to get the correct results, I just knock it out in a few minutes and I don’t even charge them, which makes them particularly satisfied. That’s the part where he REALLY gasped and said,

“I would NEVER do that!”


2 Responses to “Proc Summary and other bricolage”

  1. plop on April 23rd, 2013 6:41 am

    tu bricoles, tu bricoles… Bricoleuse !

  2. Bricolage: My autobiography, with SAS procedures : AnnMaria's Blog on September 13th, 2017 12:14 pm

    […] the next few posts, I’ll explain a dozen ways in which I have built a career by bricolage – that is, from building stuff – programs, companies – usin… All of my various careers have had their roots in statistics and SAS. Could I have learned the […]

Leave a Reply