Tag: macro

NOTE: Macro Arrays, Straight From a Data Set

I love the SAS macro language, and I do a lot of work in it. It’s not uncommon to want to have an array of macro variables with values taken from a data set. Here’s how I most-often do it…

Of course, macro language doesn’t explicitly support array…

NOTE: The OPEN Function (error trapping)

In my previous two posts on this topic (listed at the bottom of this post), I’ve described how to use the OPEN function (and its counterparts) to read data sets from macro code, and to read data sets within a DATA step without using the SET/UPDATE/MODI…

NOTE: The OPEN Function (reading data sets in macros)

In my previous post on this subject, I showed how to use the DATA step’s OPEN function to get information about data sets and make that information available within a DATA step or as a macro variable. In today’s post I will take it further and show how…

NOTE: The OPEN Function (getting data set information in macros)

There are a number of ways of accessing the content of SAS data sets. DATA steps and PROCs are two obvious means. Another method is to use the DATA step’s OPEN function.

Let’s start with some basics. Here’s a DATA step that is able to establish whethe…

My SAS Books: Shopping List 2012

Last year I threw away all my SAS books (to friends and colleagues in Beijing) before moving to US. You might agree that it’s not economically bound to transport such heavy books intercontinentally! Now I just start to build my SAS library one by one. I will most probably not buy more SAS books as […]

Extract the Version of SAS and OS of a SAS Format or Macro Catalog: A Little Bit of Perl Regular Expression

SAS Sample 34444(Determine the operating system in which a format catalog was created) posts piece of codes to get the version of SAS and OS of a SAS format catalog. It is useful since a SAS catalog can be only read in the operating systems same to its source machine. 2 cents add to this […]

Macro Quoting in SAS Data Integration Studio

You can run the following piece of codes successfully in these 3 SAS programming environments: BASE SAS Enterprise Guide: create a new “File-New-Program” SAS Data Integration Studio: create a new “Tool-Code Editor” %let species="Setosa" "Versicolor"; data a;     set sashelp.iris;     where species in (&species); run; Then create a Transformation in SAS Data Integration Studio […]

Use GREPLAY to create multiple graphs per page

Desired result:This sample program uses PROC GREPLAY together with macro code to dynamically replay a specific number of graphs per page.The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SA…