DATA Step, Macro, Functions and more

MACRO: MPRINT incorrect macro value parameter

Reply
Frequent Contributor
Posts: 79

MACRO: MPRINT incorrect macro value parameter

I found this little curiousity today:

 

1589 %macro m_r_options_pagelayout

1590    ( topmargin    = 0.375in

1591    , leftmargin   = 0.750in

1592    , rightmargin  = 0.375in

1593    , bottommargin = 0.375in

1594    ) ;

1595

1596   options orientation  = portrait

1597           topmargin    = &topmargin.

1598           leftmargin   = &leftmargin.

1599           rightmargin  = &rightmargin.

1600           bottommargin = &bottommargin.

1601           ;

1602

1603 %mend m_r_options_pagelayout ;

1604

1605 options mprint ;

1606 %m_r_options_pagelayout( )

MPRINT(M_R_OPTIONS_PAGELAYOUT): options orientation = portrait topmargin = 0.375

leftmargin = 0.750 rightmargin = 0.375 bottommargin = 0.375 ;

1607

1608 options nomprint ;

1609 %put %m_r_options_pagelayout( ) ;

options orientation = portrait topmargin = 0.375in

leftmargin = 0.750in rightmargin = 0.375in bottommargin

= 0.375in

 

Notice that the MPRINT of the macro call OMITS the in (inches).  Does anyone explanation?  Note that this is not SAS stripping off IN because that is the default units for this options:

 

1621 %m_r_options_pagelayout

1622    ( topmargin = 0.375cm

1623    )

MPRINT(M_R_OPTIONS_PAGELAYOUT): options orientation = portrait topmargin = 0.375

leftmargin = 0.750 rightmargin = 0.375 bottommargin = 0.375 ;

 

 

v9.4

Operating System: WX64_SV .

 

Thank you,

 

Kevin

Super User
Super User
Posts: 6,498

Re: MACRO: MPRINT incorrect macro value parameter

It is storing the units.  It is just MPRINT output that is miss leading.

It does it with SAS 9.2 also.  

Super User
Posts: 10,483

Re: MACRO: MPRINT incorrect macro value parameter

However note that if you run Proc Options the units do appear. An interesting artifact though.

Super User
Posts: 17,784

Re: MACRO: MPRINT incorrect macro value parameter

In SAS 9.4 TS1M3 similar behaviour. 

MPRINT strips the units but they are being resolved properly via Symbolgen.

 

2
3    %macro m_r_options_pagelayout
4       ( topmargin    = 0.375in
5       , leftmargin   = 0.750in
6       , rightmargin  = 0.375in
7       , bottommargin = 0.375in
8       ) ;
9
10     options orientation  = portrait
11             topmargin    = &topmargin.
12             leftmargin   = &leftmargin.
13             rightmargin  = &rightmargin.
14             bottommargin = &bottommargin.
15             ;
16
17   %mend m_r_options_pagelayout ;
18
19   %m_r_options_pagelayout;
SYMBOLGEN:  Macro variable TOPMARGIN resolves to 0.375in
SYMBOLGEN:  Macro variable LEFTMARGIN resolves to 0.750in
SYMBOLGEN:  Macro variable RIGHTMARGIN resolves to 0.375in
SYMBOLGEN:  Macro variable BOTTOMMARGIN resolves to 0.375in
MPRINT(M_R_OPTIONS_PAGELAYOUT):   options orientation = portrait topmargin = 0.375
leftmargin = 0.750 rightmargin = 0.375 bottommargin = 0.375 ;
Frequent Contributor
Posts: 79

Re: MACRO: MPRINT incorrect macro value parameter

See: http://www.pharmasug.org/proceedings/2016/TT/PharmaSUG-2016-TT17.pdf

 

MFILE captures the WRONG value, too:

 

%m_debug_mfile

( mcall = m_r_options_pagelayout( topmargin = 0.5cm ))

 

options orientation = portrait topmargin = 0.5 leftmargin = 0.750 rightmargin = 0.375 bottommargin = 0.375 ;

 

This would be 0.5in NOT 0.5cm, since in is the default.

Super User
Posts: 17,784

Re: MACRO: MPRINT incorrect macro value parameter

No, it gets set properly, how MPRINT displays is the issue. You can check the value of the option set:

 

%put topmargin= %sysfunc(
     getoption(topmargin));
Ask a Question
Discussion stats
  • 5 replies
  • 308 views
  • 0 likes
  • 4 in conversation