BookmarkSubscribeRSS Feed
TheresaM
Obsidian | Level 7

I'm just checking my understanding.  From what I understand, if the following is correct:

 

Screenshot 2024-01-22 at 8.34.45 PM.png

 

Then is the following not correct?  My responses would have been:  189.87%, 696.20% and 31.54%.

 

Screenshot 2024-01-22 at 8.34.55 PM.png

2 REPLIES 2
mkeintz
PROC Star

In the program below

proc format ;
  picture mypct  low-high='009.99%'  (multiplier=100 ) ;
run;
data _null_;
  do percent=1.8987,6.6920,0.3165;
    put 'Default Format: ' percent=  @36 'Using mypct: ' (percent) (mypct.) ;
  end;
run;

the log shows:

Default Format: percent=1.8987     Using mypct:   1.89%
Default Format: percent=6.692      Using mypct:   6.69%
Default Format: percent=0.3165     Using mypct:   0.31%

Consider the first value (1.8987):

  1. First, the "multiplier=100" option converts 1.8987 to 189.87

  2. Then remember that the picture will be applied only to digits to the left of the decimal point, i.e. only to 189.  I think this is where you are being thrown off.  Ignoring the digits after the post-multiplier decimal provides a way to treat 1.8987 the same as 1.8900 (which would become 189 under "multiplier=100").   They both only have the same three digits to the left of the decimal point.

  3. Finally, applying '009.99%' picture to the digits 189, proceeding from right to left, yields 1.89%.

 

You can take a close look at the "multiplier=n" sections of PICTURE Statement 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ballardw
Super User

Shorter answer: the 9 in a picture format is a digit selector. So if the format selects ONE decimal place as in your '009.9' then it will only display one decimal place.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Autotuning Deep Learning Models Using SAS

Follow along as SAS’ Robert Blanchard explains three aspects of autotuning in a deep learning context: globalized search, localized search and an in parallel method using SAS.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 830 views
  • 3 likes
  • 3 in conversation