Wednesday, March 21, 2018

Calling a SAS macro from a data step

Controlling a macro using a data step can be very helpful when you want to use a set of values in a macro and would like a clean way to introduce them.

The real trick is using the line "call excecute(%macro_name);" This allows the macro to be called for each row of data.

Sample code:

Data set:

data data_1;
   input name $ age;
datalines;
Fred 5
Mike 8 
Joel 6
;


Macro sample:

%macro print(name,n);
%put "&name. is &n years old.";
%mend;

Macro call:

Data _null_;
set data_1;
call execute('%print('||name||','||'age)');
run;


Thanks for your time today.

Monday, September 27, 2010

If you fold towels your job is safe

I found this article wonderful. It goes into the ideas that as long as your job is too simple to be worth making a robot do it you are safe. Or if you are too advanced at that thinking stuff you should be safe. So professors and janitors rejoice. The rest of us keep watching out for when the geek shows up to measure just exactly what you do.
http://www.economist.com/node/16990700?story_id=16990700&CFID=148874688&CFTOKEN=11523152

Monday, July 5, 2010

07/05/2010

I want to show you guys the site Economists do it with models. This site looks to be a fun place. Join the mailing list and she will send you out a free sticker with an interesting graph on it. I hope she keeps up the great work.

I am slowly working my way through the writings of Ben Bernanke on the great depression. There is a book compiled on lectures given by him on the subject. Very eye opening views from the man who is currently guiding our ship through the rough seas ahead. I feel safer after reading it knowing the man at the helm has studied his entire academic life in the subject of financial panics.