Analytics 2015 lands in Rome on Nov. 9-11

The digital disruption phenomenon is redrawing the market map. New players, products and services are gaining competitive advantage, while traditional business and revenue models are being questioned. Gartner believes that by 2020, thanks to the Internet of Things, information will be used to reinvent, digitalize or eliminate 80% of business […]

The post Analytics 2015 lands in Rome on Nov. 9-11 appeared first on SAS Learning Post.

SAS macros always have a global scope

SAS allows the programmer to declare the scope of macro variables using %LOCAL or %GLOBAL, but the macros themselves are always created in the global scope.

Say you have a macro that in another language, say Python, would be considered a function. Within the macro you want a sub-macro (i.e., sub-function) to be used only within the outer macro.


%macro outer;
%put NOTE: outer;

/* This "sub-macro" is defined within the outer macro and is
intended only for use within the outer macro. */
%macro inner(foo);
%put NOTE: inner &foo;
%mend;

%inner(1);
%inner(2);
%mend;

%outer;

/* If the "sub-macro" has a local scope, the next step would fail */
%inner(3);

/* However, it succeeds */

This can lead to conflicts if the macro %inner is defined somewhere else in the same session. One way of dealing with this is to be careful to give the inner macro a unique name like __outer_inner where the underscores in the prefix suggest a local scope, and adding outer to the macro name indicates the macro is to be used only in the outer macro.

Another option is to use the %sysmacdelete to delete the inner macro:


%macro outer;
%put NOTE: outer;

%macro inner(foo);
%put NOTE: inner &foo;
%mend;

%inner(1);
%inner(2);
/* Delete the inner macro */
%SYSMACDELETE inner;
%mend;

%outer;

/* This fails because of SYSMACDELETE */
%inner(3);

Tested with SAS 9.4M3 on Windows 7.

For more posts like this, see Heuristic Andrew.

Serving up SAS training in cities near you

The 2015 United States Tennis Open tournament is now underway, and like most tennis fans, I’ve got my eyes on women’s tennis great Serena Williams, as she attempts to make history by winning the tournament and achieving a calendar Grand Slam. What are her chances of reaching the milestone?  Most […]

The post Serving up SAS training in cities near you appeared first on The SAS Training Post.

NOTE: SAS "Inside" of Hadoop

We previously looked at SAS Grid Manager for Hadoop, which brings workload management, accelerated processing, and scheduling to a Hadoop environment. This was introduced with the m3 maintenance release of SAS v9.4. M3 also introduced support for using…