| |

SAS On-Demand making statistics professors’ lives better, since, oh, Tuesday

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.

Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *