<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Proc Format - create format similar to PERCENTw.d in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290831#M59800</link>
    <description>&lt;P&gt;How can I&amp;nbsp;create a format that is functionally equivalent to PERCENTw.d, but with the string \% appearing instead of the % sign?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that PERCENTw.d operates by multiplying&amp;nbsp;a&amp;nbsp;term&amp;nbsp;by 100, converting to BESTw.d, and then appending a % symbol.&amp;nbsp; But I have not been able to reconstruct this process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.functions.smd;
 function LPCfunc(x) $;
 return(cats(100*x,'\%'));
 endsub;
run;

options cmplib=(work.functions);

proc format;
 value LPC  other=[LPCfunc()];
 run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This function LPCfunc seems to work, and according to the log, a format called LPC is being generated.&amp;nbsp; But I cannot seem to call it.&amp;nbsp; When I try using it in a format declaration, the variable ends up having format BEST12.:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp1;
set temp1;
format C percent10.4;
run;

data temp1;
set temp1; 
format E LPC.;
D=LPCfunc(C); 
E=C;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS for Windows 9.4 TS Level 1M0.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2016 21:54:40 GMT</pubDate>
    <dc:creator>MatthewJ</dc:creator>
    <dc:date>2016-08-10T21:54:40Z</dc:date>
    <item>
      <title>Proc Format - create format similar to PERCENTw.d</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290831#M59800</link>
      <description>&lt;P&gt;How can I&amp;nbsp;create a format that is functionally equivalent to PERCENTw.d, but with the string \% appearing instead of the % sign?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that PERCENTw.d operates by multiplying&amp;nbsp;a&amp;nbsp;term&amp;nbsp;by 100, converting to BESTw.d, and then appending a % symbol.&amp;nbsp; But I have not been able to reconstruct this process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.functions.smd;
 function LPCfunc(x) $;
 return(cats(100*x,'\%'));
 endsub;
run;

options cmplib=(work.functions);

proc format;
 value LPC  other=[LPCfunc()];
 run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This function LPCfunc seems to work, and according to the log, a format called LPC is being generated.&amp;nbsp; But I cannot seem to call it.&amp;nbsp; When I try using it in a format declaration, the variable ends up having format BEST12.:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp1;
set temp1;
format C percent10.4;
run;

data temp1;
set temp1; 
format E LPC.;
D=LPCfunc(C); 
E=C;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS for Windows 9.4 TS Level 1M0.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 21:54:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290831#M59800</guid>
      <dc:creator>MatthewJ</dc:creator>
      <dc:date>2016-08-10T21:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format - create format similar to PERCENTw.d</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290834#M59801</link>
      <description>&lt;P&gt;Your code is partially correct.&lt;/P&gt;
&lt;P&gt;How you create the format is correct, how you're trying to use it perhaps not?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data test;
 set sashelp.class;
 weight2=weight/100;
 format weight2 lpc.;
 run;

 proc print data=test;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Thsi is what I get:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Obs    Name       Sex    Age    Height    Weight    weight2

                    1    Alfred      M      14     69.0      112.5    112.5\%
                    2    Alice       F      13     56.5       84.0    84\%
                    3    Barbara     F      13     65.3       98.0    98\%
                    4    Carol       F      14     62.8      102.5    102.5\%
                    5    Henry       M      14     63.5      102.5    102.5\%
                    6    James       M      12     57.3       83.0    83\%
                    7    Jane        F      12     59.8       84.5    84.5\%
                    8    Janet       F      15     62.5      112.5    112.5\%
                    9    Jeffrey     M      13     62.5       84.0    84\%
                   10    John        M      12     59.0       99.5    99.5\%
                   11    Joyce       F      11     51.3       50.5    50.5\%
                   12    Judy        F      14     64.3       90.0    90\%
                   13    Louise      F      12     56.3       77.0    77\%
                   14    Mary        F      15     66.5      112.0    112\%
                   15    Philip      M      16     72.0      150.0    150\%
                   16    Robert      M      12     64.8      128.0    128\%
                   17    Ronald      M      15     67.0      133.0    133\%
                   18    Thomas      M      11     57.5       85.0    85\%
                   19    William     M      15     66.5      112.0    112\%
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 22:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290834#M59801</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-10T22:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format - create format similar to PERCENTw.d</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290863#M59805</link>
      <description>&lt;P&gt;You could use a picture format. Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture lpc
-1 -&amp;lt; 0 = '009.99\%)' (mult=10000 prefix='(')
0 - high = '009.99\%' (mult=10000);
run;

data _null_;
do x = -1, -0.999, -0.5, -0.05, 0, 0.01, 0.5, 1.5555, 2;
    put x= 7.2 +5 x lpc10.;
    end;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;x=-1.00      (100.00\%)
x=-1.00       (99.90\%)
x=-0.50       (50.00\%)
x=-0.05        (5.00\%)
x=0.00          0.00\%
x=0.01          1.00\%
x=0.50         50.00\%
x=1.56        155.55\%
x=2.00        200.00\%
&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Aug 2016 03:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/290863#M59805</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-08-11T03:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format - create format similar to PERCENTw.d</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/291072#M59836</link>
      <description>&lt;P&gt;Also, make sure that WORK is in your FMTSEARCH path, assuming you're placing the new format into the WORK library:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options insert(fmtsearch=(WORK));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Aug 2016 20:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Format-create-format-similar-to-PERCENTw-d/m-p/291072#M59836</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-08-11T20:22:16Z</dc:date>
    </item>
  </channel>
</rss>

