<?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: Adding values to an existing format and turn it into multilabel in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986125#M84137</link>
    <description>&lt;P&gt;&lt;SPAN&gt;In this blog you find an example that creates a multilabel format using the CNTLIN= option in PROC FORMAT.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Creating and Using Multilabel Formats&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV class="post-meta cf"&gt;&lt;SPAN class="posted-by"&gt;By&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="reviewer"&gt;&lt;A title="Posts by Jerry Leonard" href="https://blogs.sas.com/content/author/jerryleonard/" rel="author" target="_blank"&gt;Jerry Leonard&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://blogs.sas.com/content/sgf/" target="_blank"&gt;SAS Users&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="posted-on"&gt;&lt;SPAN class="dtreviewed"&gt;&lt;TIME class="value-title" title="2016-12-16" datetime="2016-12-16T13:58:31-04:00"&gt;December 16, 2016&lt;/TIME&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://blogs.sas.com/content/sgf/2016/12/16/creating-and-using-multilabel-formats/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2016/12/16/creating-and-using-multilabel-formats/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also ... in this NESUG 2008 conference paper, you find&amp;nbsp;MULTILABEL FORMATS WITH CNTLIN DATASETS.&lt;BR /&gt;&lt;STRONG&gt;Multiple Facts about Multilabel Formats&lt;/STRONG&gt; &lt;BR /&gt;Gwen D. Babcock, New York State Department of Health, Troy, NY &lt;BR /&gt;&lt;A href="https://lexjansen.com/nesug/nesug08/cc/cc14.pdf" target="_blank"&gt;https://lexjansen.com/nesug/nesug08/cc/cc14.pdf&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or ... go here:&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class="lia-link-navigation child-thread lia-link-disabled" aria-label="creating multi labels using proc format cntlin" aria-disabled="true"&gt;creating multi labels using proc format cntlin&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/creating-multi-labels-using-proc-format-cntlin/td-p/595399" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/creating-multi-labels-using-proc-format-cntlin/td-p/595399&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Instead of using a CNTLIN= dataset, you can also generate your PROC FORMAT code dynamically from a dataset. This is called data-driven dynamic code generation. You use a datastep with a FILE statement and PUT statements and once the SAS program is created you %INCLUDE it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Apr 2026 16:34:01 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2026-04-08T16:34:01Z</dc:date>
    <item>
      <title>Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986124#M84136</link>
      <description>&lt;P&gt;I have a user-defined format (created by cntlin= from a SAS dataset); I want to add values to the format and turn it into a multilabel format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am unsure how to do this ... .&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 16:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986124#M84136</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2026-04-08T16:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986125#M84137</link>
      <description>&lt;P&gt;&lt;SPAN&gt;In this blog you find an example that creates a multilabel format using the CNTLIN= option in PROC FORMAT.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Creating and Using Multilabel Formats&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV class="post-meta cf"&gt;&lt;SPAN class="posted-by"&gt;By&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="reviewer"&gt;&lt;A title="Posts by Jerry Leonard" href="https://blogs.sas.com/content/author/jerryleonard/" rel="author" target="_blank"&gt;Jerry Leonard&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://blogs.sas.com/content/sgf/" target="_blank"&gt;SAS Users&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="posted-on"&gt;&lt;SPAN class="dtreviewed"&gt;&lt;TIME class="value-title" title="2016-12-16" datetime="2016-12-16T13:58:31-04:00"&gt;December 16, 2016&lt;/TIME&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://blogs.sas.com/content/sgf/2016/12/16/creating-and-using-multilabel-formats/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2016/12/16/creating-and-using-multilabel-formats/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also ... in this NESUG 2008 conference paper, you find&amp;nbsp;MULTILABEL FORMATS WITH CNTLIN DATASETS.&lt;BR /&gt;&lt;STRONG&gt;Multiple Facts about Multilabel Formats&lt;/STRONG&gt; &lt;BR /&gt;Gwen D. Babcock, New York State Department of Health, Troy, NY &lt;BR /&gt;&lt;A href="https://lexjansen.com/nesug/nesug08/cc/cc14.pdf" target="_blank"&gt;https://lexjansen.com/nesug/nesug08/cc/cc14.pdf&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or ... go here:&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class="lia-link-navigation child-thread lia-link-disabled" aria-label="creating multi labels using proc format cntlin" aria-disabled="true"&gt;creating multi labels using proc format cntlin&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/creating-multi-labels-using-proc-format-cntlin/td-p/595399" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/creating-multi-labels-using-proc-format-cntlin/td-p/595399&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Instead of using a CNTLIN= dataset, you can also generate your PROC FORMAT code dynamically from a dataset. This is called data-driven dynamic code generation. You use a datastep with a FILE statement and PUT statements and once the SAS program is created you %INCLUDE it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 16:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986125#M84137</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-04-08T16:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986128#M84138</link>
      <description>&lt;P&gt;Figure out how SAS stores the value for a MLF in a CNTLIN= dataset by making one by code and looking at the dataset generated by the CNTLOUT= option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format cntlout=formats;

value myfmt (multilabel)
  1 = "One"
  2 = "Two"
  3 = "Three"
  4 = "Four"
  5 = "Five"
  1,3,5 = "Odd"
  2,4 = "Even"
  1-5 = "1-5"
;

run;

proc print data=formats;
  var fmtname type start end label hlo sexcl eexcl ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-04-08 at 12.38.59 PM.png" style="width: 814px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114160i8E50F3321B725A16/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-04-08 at 12.38.59 PM.png" alt="Screenshot 2026-04-08 at 12.38.59 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So basically just add the extra observations you need and set the HLO variable 'SM'.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 16:39:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986128#M84138</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-04-08T16:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986131#M84139</link>
      <description>&lt;P&gt;I notice that SAS has given the MYFMT format the NOTSORTED attribute in the CNTLOUT data set, HLO='SM' even though you did not specify NOTSORTED in the VALUE statement options list.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I did not expect that output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Figure out how SAS stores the value for a MLF in a CNTLIN= dataset by making one by code and looking at the dataset generated by the CNTLOUT= option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format cntlout=formats;

value myfmt (multilabel)
  1 = "One"
  2 = "Two"
  3 = "Three"
  4 = "Four"
  5 = "Five"
  1,3,5 = "Odd"
  2,4 = "Even"
  1-5 = "1-5"
;

run;

proc print data=formats;
  var fmtname type start end label hlo sexcl eexcl ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-04-08 at 12.38.59 PM.png" style="width: 814px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114160i8E50F3321B725A16/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-04-08 at 12.38.59 PM.png" alt="Screenshot 2026-04-08 at 12.38.59 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So basically just add the extra observations you need and set the HLO variable 'SM'.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 19:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986131#M84139</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2026-04-08T19:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986133#M84140</link>
      <description>&lt;P&gt;So, HLO=SM is what tells SAS this is a multi-label format? Not the most obvious solution I have ever encountered, but it does the trick -- thanks!&lt;/P&gt;&lt;P&gt;By the way -- where is this (and the other fields in that cntlout file) documented? Even The Google was perplexed&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 20:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986133#M84140</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2026-04-08T20:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986134#M84141</link>
      <description>&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0owa4ftikc2ekn1q0rmpulg86cx.htm" target="_blank" rel="noopener"&gt;SAS Help Center: Results: PROC FORMAT&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461805"&gt;@dwaldo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So, HLO=SM is what tells SAS this is a multi-label format? Not the most obvious solution I have ever encountered, but it does the trick -- thanks!&lt;/P&gt;
&lt;P&gt;By the way -- where is this (and the other fields in that cntlout file) documented? Even The Google was perplexed&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think this is a really good discussion if really good.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/nesug/nesug08/cc/cc14.pdf" target="_blank"&gt;Multiple Facts about Multilabel Formats&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 20:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986134#M84141</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2026-04-08T20:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding values to an existing format and turn it into multilabel</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986137#M84142</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I notice that SAS has given the MYFMT format the NOTSORTED attribute in the CNTLOUT data set, HLO='SM' even though you did not specify NOTSORTED in the VALUE statement options list.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I did not expect that output.&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think that it what the paper you cited means when it talks about sorting.&lt;/P&gt;
&lt;P&gt;Essentially when you using the LABEL statement of PROC FORMAT without the NOTSORTED option for a multilabel format it sorts by the START value and then generates the control dataset in that order and set the 'S' tag of the HLO variable to preserve it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see it by replicating the AGE format from that paper.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format cntlout=formats;
value age (multilabel)
19-120='Adults'
1-18='Children'
1-4='Preschool'
;
value ages (multilabel notsorted)
19-120='Adults'
1-18='Children'
1-4='Preschool'
;
run;

data compare;
  N+1;
  set formats(where=(fmtname='AGE') rename=(start=AGE_START end=AGE_END label=AGE_LABEL));
  set formats(where=(fmtname='AGES') rename=(start=AGES_START end=AGES_END label=AGES_LABEL));
run;

proc print;
var N age: ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-04-08 at 5.49.28 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/114162i97AC6DBB2312C945/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-04-08 at 5.49.28 PM.png" alt="Screenshot 2026-04-08 at 5.49.28 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2026 21:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-values-to-an-existing-format-and-turn-it-into-multilabel/m-p/986137#M84142</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-04-08T21:50:47Z</dc:date>
    </item>
  </channel>
</rss>

