Posts Tagged ‘ Snippets ’

Stamping the SAS Log with all Macro Variable Values

April 3, 2012
By

The topic of the day around the office was stamping all of the user created macro variables into the log function. I’ve got a few programs that have a lot (20+) auto-generated dates, etc and the following is just one of the the many ways to print what each macro resolves to into your...
Read more »

Tags: ,
Posted in SAS | Comments Off

How many days until?

December 12, 2011
By

A simple little macro I whipped up that’ll count down the number of days until an important event. %macro daysUntil(event, date); data _null_; diff = datdif(today(), input("&date.", anydtdte10.), 'act/act'); call symput('days_until', strip(diff)); run; %put There are &days_until days until &event; %mend; Macro call is straight forward: %daysUntil(Christmas, 12/25/2011); %daysUntil(Columbia_Marathon, 03/10/2012); I could have used...
Read more »

Tags: ,
Posted in SAS | Comments Off

Variable Names into Macro Variables

October 21, 2011
By

Late last month, I posted an answer to a question on StackOverflow. This morning, I had to use something similar at work and it reminded me that ability to pull variable names out of a data set is a handy trick. For the example, I’m using the yr1001 data set from sashelp to avoid...
Read more »

Tags: , ,
Posted in SAS | Comments Off

Off to Bitbucket

October 21, 2011
By

With Bitbucket now offering git support, it made sense to transfer over my repositories from github. I have a lot of code (macro’s and examples) that I reference currently stored dumped onto a single page google site. I haven’t scrubbed out any proprietary information / work references so those snippets have to remain private...
Read more »

Tags: ,
Posted in SAS | Comments Off

Automatically Generate Days of the Month

October 4, 2011
By

Run a monthly report and absolutely hate having to change the macro variables? Luckily SAS has the handy intnx function to make your life easier. The following code will automatically generate the date for the first / last day of the previous month.  Modify the -1 to however many previous months you need to...
Read more »

Tags: ,
Posted in SAS | Comments Off

Proc-x is looking for sponsors!

Dear readers, proc-x is looking for sponsors who would be willing to support the site in exchange for banner ads in the right sidebar of the site. If you are interested, please e-mail me at: [email protected]

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.