Monthly Archives: October 2009

Easy Inserting/Appending Libraries into FMTSEARCH path lists in SAS 9.2

In SAS 9.1.3 and prior, Options list (such as FMTSEARCH for libraries with format catalogs, and SASAUTOS for paths that contain macros shared across jobs) were annoying to work with. If you have nested code that wants to add a library or a path the list, doing so like this could potentially clobber statements executed […]

Counting distinct variables in SQL with SAS

One way to get the count of distinct variables, which works in most flavors of SQL, is to use a subquery. For instance, in Oracle this is: SELECT count(SELECT DISTINCT foo FROM table) FROM dual In SAS, using PROC SQL, you can do that too, but you can also simply do this: SELECT count(distinct foo) […]

The Family Reunion Problem

Here’s an interesting problem. I would like to call this the family reunion problem. As far as I know, this problem hasn’t been stated or generalized anywhere else. But maybe it has? Suppose a set of people live in different cities and wish to have a reunion. They’re fairly far apart such that they’ll be […]