# Any SAS users (beside me) in this forum?

1. Nov 13, 2015

### DrDu

I am using SAS (sweat and suffer) for many years now on a daily basis in work and it would be nice to be able to exchange here some problems. However, searching for "SAS" in physics forums only turns up tons of post related to science advisors (SAs).

2. Nov 13, 2015

### andrewkirk

My main tool for statistical analysis is R, but I use SAS sometimes, because there are some protected data sets that can only be accessed through a SAS engine. I don't know if my little knowledge would be any use but if I see any new threads with SAS in the title I'd probably have a look and comment if I thought I could say anything useful, because I do need to keep my knowledge levels up.

Is your work in the bio sciences? My impression is that SAS has a very strong presence in that field, and much less so in physics. I come across it fairly often in my own field of finance, too - about 50/50 with R (and, very lamentably, Excel ).

3. Nov 14, 2015

### DrDu

Yes, I work AS an epidemiologist.

4. Nov 15, 2015

### Ibix

Me, for my sins. Happy to discuss it - as long as you don't mind the occasional rant about how much I dislike it...

5. Nov 15, 2015

### DrDu

I don't know whether I ever met anyone who really liked SAS :-)
I am using SAS now under Linux and I am especially pissed off the stone age style integrated environment (not that I would be more fond having to work under Windows). I am trying now to use some other editor (vim in my case) with SAS. There exist EDITCMD and HOSTEDIT commands, but I didn't find much about its use on the internet. I also tried to copy code to some jointly used buffer and submit it from there, but I didn't figure this out yet.

6. Nov 15, 2015

### andrewkirk

@DrDu: My use of SAS is mostly under Linux too. I use UniversitySAS (because we don't have to pay for it) running in an Oracle VirtualBox virtual machine. The edit capability is very limited, although one thing I like about SAS is the pretty colour-coding. Whenever I have to do more complicated code editing I copy the code across to a text editor, make the changes, then copy it back to the SAS window (which is in a browser). Gedit has the advantage that it recognizes SAS code if you save the files as something.sas, and then does some colour-coding and bracket matching to help. Gedit doesn't have regular expression capability though, so I switch to Geany when I need to do that. One day I mean to re-learn emacs, which I suspect may be able to do both of those.

I think the reason SAS seems so old-fashioned is that it is AFAIK the oldest statistical processing language, and was developed in the seventies. So to me it looks a bit like FORTRAN. Even FORTRAN doesn't put a statement terminator after a DO though - I'm still coming to terms with the idea of:

DO;
something;
END;

The macro language seems so much more complicated and unintuitive than what's in other languages too. But I suppose one gets used to it and then doesn't notice any more.

7. Nov 15, 2015

### DrDu

Yes, emacs and vom also habe colouring schemes for SAS code.

8. Nov 16, 2015

### Ibix

I've got SAS on Windows, and am stuck with the built in editor because the system is so locked down. Actually, the Advanced Editor is one of the least dislikable parts of SAS. Its "keyboard macros" let you write a lot of standard stuff with a few keystrokes, and it's actually got regex search and replace.

I think the basic problem with SAS is that its original authors didn't quite have the vision to see what they wanted to do, and kept growing the system to plaster over shortcomings rather than rebuild. That's the macro language through and through - it's a patch to allow you to do things like process a bunch of data sets in the same way, but it's a layer on top of the data processing language and the interface between the two is quite clunky.

Personal opinion, obviously. But that's what it looks lik to me.

9. Nov 17, 2015

### DrDu

I agree with you on SAS problems.
Under Unix, there is no enhanced editor. What I did now was to set key F3 in SAS to "submit buffer=xclipbrd" so that I can submit simply the copied part from my text editor. Clearly it would be even nicer if I could define some key within the editor to pass the "submit" command to SAS. I tried something
like "echo tput (kf3) > /usr/proc/123/fg/0" but this didn't work.

10. Nov 18, 2015

### Ibix

No enhanced editor would be a problem.

I can't think of a workaround to let you submit from your editor. The best I can think of is to do something like invoke SAS using -stdio and feeding its stdin from your editor and capturing its stdout and stderr somehow. Then start a second instance of SAS so that you can use the Explorer. Not sure how you'd handle the results window though, even assuming this works at all.

11. Nov 19, 2015

### DrDu

I found a way to pass a command to the SAS Editor: with "wmctrl -l" I get a list of all open xwindows and their ID's.
With "xdotool key --window <ID> F3" I can pass e.g. the F3 key to that program.
This can be combined into
xdotool key --window $(wmctrl -l | grep "SAS: Program Editor" | awk '{print$1}') F3
which can be mapped to a key of the editor.

Last edited: Nov 19, 2015
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook