Mistakes with SAS Today

Every now and then I post a mistake I made using either statistical software or statistics. Students often get discouraged feeling they make so many mistakes and they will never get it all right. No one gets it all right all the time.

Obvious mistake of the day ….

I was making minor cosmetic changes on a production job on a test computer and none of the data for the current week were being selected. This is bad. It kept reading only 20 observations. I reviewed the code for a subsetting IF statement or other logic that would delete all but 20 observations. Nope, looked fine. It was supposed to read the records in the last week:

If rec_day > today() – 8 then do :

Using the SAS function today() and then doing a bunch of stuff.

I created a null dataset and put the value of today() to my SAS log

Data _null_ ;

set odd_data ;

put “Record Day = ” rec_day ;

put “Today = ” today () ;

Only 20 records were printed and sure enough, none of them were within the last week. The value of today() was exactly what it should be.

what_the_hell.jpgI was testing the new SAS 9.2 — could that be it ?

Then, it dawned on me in one of those moments where you slap your head and can’t believe you missed it. Earlier in the day, I had been running another job trying to format some output to be exactly right. Since I didn’t want pages of output, I had set

options obs = 20 ;

I had just closed the old program, opened the new one and kept on going.

My code was fine, the options were still in effect. I re-set

options obs = max ;

and life was good again.

local_offerevent_note June 11, 2008

account_box AnnMaria De Mars

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.