<?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 Re: proc format Ronein in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955727#M373232</link>
    <description>&lt;P&gt;If you have the intervals stored in a data set/table, you can feed PROC FORMAT using CNTLIN.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1e19y6lrektafn1kj6nbvhus59w.htm" target="_blank"&gt;SAS Help Center: Creating a Format from a CNTLIN= Data Set&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jan 2025 11:15:52 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2025-01-10T11:15:52Z</dc:date>
    <item>
      <title>proc format Ronein</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955709#M373229</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I try to create this format.&lt;/P&gt;
&lt;P&gt;What is the way to create it by&amp;nbsp; dynamic code and not manually type all this code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc format;
value F_Ronein
0='(1) 0'
0&amp;lt;-100='(2) 0-100'
100&amp;lt;-200='(3) 100-200'
200&amp;lt;-300='(4) 200-300'
300&amp;lt;-400='(5) 300-400'
400&amp;lt;-500='(6) 400-500'
500&amp;lt;-1000='(7) 500-1000'
1000&amp;lt;-2000='(8) 1000-2000'
2000&amp;lt;-3000='(9) 2000-3000'
3000&amp;lt;-4000='(10) 3000-4000'
4000&amp;lt;-5000='(11) 4000-5000'
5000&amp;lt;-6000='(12) 5000-6000'
6000&amp;lt;-7000='(13) 6000-7000'
7000&amp;lt;-8000='(14) 7000-8000'
8000&amp;lt;-9000='(15) 8000-9000'
9000&amp;lt;-10000='(16) 9000-10000'
10000&amp;lt;-15000='(17) 10000-15000'
15000&amp;lt;-High='(18) 15000+'
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jan 2025 10:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955709#M373229</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-01-10T10:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc format Ronein</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955727#M373232</link>
      <description>&lt;P&gt;If you have the intervals stored in a data set/table, you can feed PROC FORMAT using CNTLIN.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1e19y6lrektafn1kj6nbvhus59w.htm" target="_blank"&gt;SAS Help Center: Creating a Format from a CNTLIN= Data Set&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 11:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955727#M373232</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-01-10T11:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc format Ronein</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955729#M373234</link>
      <description>&lt;P&gt;Some fun with macro looping could work too:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro loopFormat(s,e,b=1,r=1,z=00);
%do i=&amp;amp;s. %to &amp;amp;e. %by &amp;amp;b.;
  %eval(&amp;amp;i.-&amp;amp;b.)&amp;amp;z.&amp;lt;-&amp;amp;i.&amp;amp;z.="(%eval(&amp;amp;i.+&amp;amp;r.)) %eval(&amp;amp;i.-&amp;amp;b.)&amp;amp;z. - &amp;amp;i.&amp;amp;z."
%end;
%mend loopFormat;

options Mprint;
proc format;
value F_Ronein
0='(1) 0'
%loopFormat(1,5,r=1)
%loopFormat(10,10,b=5,r=-3)
%loopFormat(2,10,r=6,z=000)
10000&amp;lt;-15000='(17) 10000-15000'
15000&amp;lt;-High='(18) 15000+'
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;idea of input data set seems to be more practical.&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 11:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955729#M373234</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-01-10T11:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc format Ronein</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955766#M373238</link>
      <description>&lt;P&gt;look at the issue without code. What is your rule for building the right side from the value on the left side, in plain language?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A crude way to create the CNTLIN dataset would be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cntlin;
length
  fmtname $32
  type $1
  start $8
  end $8
  label $40
  sexcl $1
  eexcl $1
;
fmtname = "F_Ronein";
type = "N";
do i = 1 to 18;
  if i = 1
  then do;
    start = "0";
    end = "0";
    label = "(1) 0";
    sexcl = "N";
    eexcl = "N";
  end;
  else if i = 2
  then do;
    start = "0";
    end = "100";
    label = "(2) 0-100";
    sexcl = "Y";
    excl = "N";
  end;
  else if i lt 7
  then do;
    start = put((i - 2) * 100,8.);
    end = put((i - 1) * 100,8.);
    label = cats("(",i,")") !! " " !! catx("-",start,end);
    sexcl = "Y";
    eexcl = "N";
  end;
  else if i = 7
  then do;
    start = "500";
    end = "1000";
    label = "(7) 500-1000";
    sexlc = "Y";
    eexcl = "N";
  end;
  else if i lt 17
  then do;
    start = put((i - 7) * 1000,8.);
    end = put((i - 6) * 1000,8.);
    label = cats("(",i,")") !! " " !! catx("-",start,end);
    sexcl = "Y";
    eexcl = "N";
  end;
  else if i = 17
  then do;
    start = "10000";
    end = "15000";
    label = cats("(",i,")") !! " " !! catx("-",start,end);
    sexcl = "Y";
    eexcl = "N";
  end;
  else /* 18 */ do;
    start = "15000";
    end = "HIGH";
    label = "(18) 15000+";
    HLO = "H";
    sexcl = "Y";
    eexcl = "N";
  end;
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can optimize from that.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 19:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955766#M373238</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-01-10T19:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc format Ronein</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955769#M373239</link>
      <description>&lt;P&gt;Probably best to build a control dataset you can pass into PROC FORMAT to make.&lt;/P&gt;
&lt;P&gt;What does it need to look like?&amp;nbsp; Why not ask PROC FORMAT to tell you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value F_Ronein
  0='(1) 0'
  0&amp;lt;-100='(2) 0-100'
  100&amp;lt;-200='(3) 100-200'
  200&amp;lt;-300='(4) 200-300'
  300&amp;lt;-400='(5) 300-400'
  400&amp;lt;-500='(6) 400-500'
  500&amp;lt;-1000='(7) 500-1000'
  1000&amp;lt;-2000='(8) 1000-2000'
  2000&amp;lt;-3000='(9) 2000-3000'
  3000&amp;lt;-4000='(10) 3000-4000'
  4000&amp;lt;-5000='(11) 4000-5000'
  5000&amp;lt;-6000='(12) 5000-6000'
  6000&amp;lt;-7000='(13) 6000-7000'
  7000&amp;lt;-8000='(14) 7000-8000'
  8000&amp;lt;-9000='(15) 8000-9000'
  9000&amp;lt;-10000='(16) 9000-10000'
  10000&amp;lt;-15000='(17) 10000-15000'
  15000&amp;lt;-High='(18) 15000+'
;
run;

proc format cntlout=formats; run;
proc print data=formats;
  var fmtname hlo sexcl eexcl start end label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    FMTNAME     HLO    SEXCL    EEXCL    START          END           LABEL

  1    F_RONEIN             N        N          0                   0    (1) 0
  2    F_RONEIN             Y        N          0                 100    (2) 0-100
  3    F_RONEIN             Y        N        100                 200    (3) 100-200
  4    F_RONEIN             Y        N        200                 300    (4) 200-300
  5    F_RONEIN             Y        N        300                 400    (5) 300-400
  6    F_RONEIN             Y        N        400                 500    (6) 400-500
  7    F_RONEIN             Y        N        500                1000    (7) 500-1000
  8    F_RONEIN             Y        N       1000                2000    (8) 1000-2000
  9    F_RONEIN             Y        N       2000                3000    (9) 2000-3000
 10    F_RONEIN             Y        N       3000                4000    (10) 3000-4000
 11    F_RONEIN             Y        N       4000                5000    (11) 4000-5000
 12    F_RONEIN             Y        N       5000                6000    (12) 5000-6000
 13    F_RONEIN             Y        N       6000                7000    (13) 6000-7000
 14    F_RONEIN             Y        N       7000                8000    (14) 7000-8000
 15    F_RONEIN             Y        N       8000                9000    (15) 8000-9000
 16    F_RONEIN             Y        N       9000               10000    (16) 9000-10000
 17    F_RONEIN             Y        N      10000               15000    (17) 10000-15000
 18    F_RONEIN     H       Y        N      15000    HIGH                (18) 15000+

&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jan 2025 19:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955769#M373239</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-10T19:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc format Ronein</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955783#M373244</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=' ';
data cntl;
   retain fmtname 'F_RONEIN' type 'N' sexcl "N";
   length s e i 8 label $64;
   s=0;
   do e = 0, 1e2 to 5e2 by 1e2, 1e3 to 1e4 by 1e3, 15e3,.H;
      i + 1;
      start = s;
      end   = e;
      select(end);
         when(.h) do; 
            hlo = 'H';
            label = catx(' ',cats('(',i,')'),cats(s,'+'));            
            end;
         otherwise do;
            hlo = ' ';
            label = catx(' ',cats('(',i,')'),catx('-',s,ifn(e=0,.,e)));
            end;
         end;
      output;
      s = e;
      sexcl = 'Y';
      end;
   run;

proc print;
   run;
proc format cntlin=cntl cntlout=cntlout;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 631px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103658iBA2D08C6EB0BC8ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 23:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-Ronein/m-p/955783#M373244</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2025-01-10T23:20:21Z</dc:date>
    </item>
  </channel>
</rss>

