Those little features missing from SAS 9.4

Here are a few missing features that would be useful for SAS programmers.

Report Real Problems, Not Potential Problems

In early versions of the SAS language, it was possible and common to reduce the length of a variable in a data step by defining the variable’s length before the set statement, without generating a warning message in the log.

Since then, things have changed. The global option that controls the length of variables now generates a warning message: varlenchk=warn.

*options varlenchk=warn;

data demo;
    set sashelp.class (keep=name sex where=(length(name)=4));
run;

data demo;
    length name $4;
    set demo;
run;
WARNING: Multiple lengths were specified for the variable name by input data set(s). This can cause truncation of data.

Rather than suggesting that the values might be truncated, it would be better if the system checked for itself and only notified me if that is actually the case.

Listing Multiple Dataset Names in a Procedure after data=

In this example, it is not possible to display all datasets beginning with “demo” using demo: in the proc print procedure.

data demo_male;
    set sashelp.class (keep=name sex where=(sex='M'));
run;

data demo_female;
    set sashelp.class (keep=name sex where=(sex='F'));
run;

*The following syntax is currently not accepted;
proc print data=demo:;
run;

Report Merge Issues By Default

A message indicating merge issues appears in the log only when the global option msglevel=i is set.

This is merely an “Information” message.

This important message is difficult to spot for the following reasons:

  • “Information” messages are displayed in black.
  • This important message gets lost among many other irrelevant “Information” messages.
  • In SAS Studio, only ERROR, WARNING, and NOTES messages are included in the log filter.
options msglevel=i;

It would therefore be very helpful if this message were included, at the very least, in the important NOTEs section.

Leave a Reply

Your email address will not be published. Required fields are marked *