An Idea Exchange for SAS software and services

Comments
by Super User
on ‎06-23-2017 10:43 AM

Did you report to Tech Support or check if there was a SAS note already? 

by Super User
‎06-23-2017 11:06 AM - edited ‎06-23-2017 11:44 AM

There was a change to the way that SAS compiled macros (back in version 9.2 I think?) that makes this macro no longer compile.  Previously it would ahve compiled ok and only generated the syntax error when it actually tried to execute those particular statements.  We found a number of our standard macros that had similar bugs that had never been caught.

 

Makes me wonder if anyone is using this SAS supplied macro.

 

If someone does update this file here are two other obvious issues.

1) The comment block that show example call uses the macro name BUILDFORMAT instead of the actual macro name of BUILDFMT.

2) The macro does not handle one level dataset names properly.  If you want to reference a work dataset you need call it with WORK.MYDATA instead of just MYDATA.

 

885  options mprint;
886  %buildfmt
887  (formatName= gender
888  ,lookupTable= gender
889  ,startColumn= code
890  ,labelColumn= decode
891  ,blanks=
892  );
ERROR: The function DEQUOTE referenced by the %SYSFUNC or %QSYSFUNC macro function has too few
       arguments.
MPRINT(BUILDFMT):   data _null_;
MPRINT(BUILDFMT):   dsid = open("gender.");
MPRINT(BUILDFMT):   call symput("dsid", compress(put(dsid, 10.)));
MPRINT(BUILDFMT):   if (dsid gt 0) then do;
MPRINT(BUILDFMT):   varnum = varnum(dsid, "code");
MPRINT(BUILDFMT):   call symput("startVar", compress(put(varnum, 10.)));
MPRINT(BUILDFMT):   if (varnum gt 0) then call symput("startType", vartype(dsid, varnum));
MPRINT(BUILDFMT):   varnum = varnum(dsid, "decode");
MPRINT(BUILDFMT):   call symput("labelVar", compress(put(varnum, 10.)));
MPRINT(BUILDFMT):   if (varnum gt 0) then call symput("labelType", vartype(dsid, varnum));
MPRINT(BUILDFMT):   call symput("anyRecords", put(attrn(dsid, "ANY"), 1.));
MPRINT(BUILDFMT):   dsid = close(dsid);
MPRINT(BUILDFMT):   end;
MPRINT(BUILDFMT):   run;

NOTE: DATA statement used (Total process time):
      real time           0.26 seconds
      cpu time            0.01 seconds


ERROR: The lookupTable could not be opened.

It also builds a character format even when the START column is numeric. 

by Super User
on ‎06-23-2017 11:17 AM

Didn't even know they existed personally. Wondered if it was something specific to the users setup initially, ie a custom company macro. 

Idea Statuses
Top Liked Authors