BookmarkSubscribeRSS Feed
KevinViel
Pyrite | Level 9

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

5 REPLIES 5
Tom
Super User Tom
Super User

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

It does it with SAS 9.2 also.  

ballardw
Super User

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

Reeza
Super User

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 ;
KevinViel
Pyrite | Level 9

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.

Reeza
Super User

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));

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1307 views
  • 0 likes
  • 4 in conversation