Tag: SAS macro

Tracing calling programs for %INCLUDE

Dear Miss SAS Answers, I run a lot of programs that call other programs with %include. I was wondering if there was a way, perhaps through a SAS Automatic Macro variable, to determine 1) whether a program was called or “included” from another program? …

Example 8.35: Grab true (not pseudo) random numbers; passing API URLs to functions or macros

Usually, we’re content to use a pseudo-random number generator. But sometimes we may want numbers that are actually random– an example might be for randomizing treatment status in a randomized controlled trial.The site Random.org provides truly rando…

Example 8.34: lack of robustness of t test with small n

Tim Hesterberg has effectively argued for a larger role for resampling based inference in introductory statistics courses (and statistical practice more generally). While the Central Limit Theorem is a glorious result, and the Student t-test remarkabl…

Example 8.30: Compare Poisson and negative binomial count models

How similar can a negative binomial distribution get to a Poisson distribution?When confronted with modeling count data, our first instinct is to use Poisson regression. But in practice, count data is often overdispersed. We can fit the overdispersio…

Default value to macro variable

NOTE: This is a great one we picked up from our friends over at the SAS community. We have run across this literally hundreds of times while programming SAS macros. You need to have a default value for a variable and you don’t want to write another macro to set it if it doesn’t exist. […]

Example 8.4: Including subsetting conditions in output

A number of analyses perform operations on subsets. Making it clear what observations have been excluded or included is helpful to include in the output.SASThe where statement (section A.6.3) is a powerful and useful tool for subsetting on the fly. (…

“call symputX” is the symput upgrade

SymputX is the upgrade from Call Symput. Syntax: call symputx(“macro_var_name”, character_value (or numeric to be converted to char), symbol table def); Where symput will produce a note about converting character values to numeric, symputx won’t produce such a note. Additionally it will strip leading and trailing spaces form the character value. Lastly, you can define […]

Sending an email from SAS

Have you ever wanted to know when your code completes? Or maybe you want to automate the report to include sending an email? Regardless, SAS is happy to send that email for you. The easiest way to do this is through the SMTP access method via filename statements. Example: filename sendemail email ‘toaddress@email.com’ subject=’This is […]