<?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: How to create a format from concatenated values? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786692#M40016</link>
    <description>&lt;P&gt;Only the putc/putn function allow dynamic formats.&lt;/P&gt;
&lt;P&gt;You could move the format-name to a macro-variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n = 3;
%let binaryformat = binary&amp;amp;n..;

data _null_;
   rows = 2**&amp;amp;n.;
   
   do i = 1 to rows;
      put i &amp;amp;binaryformat.;
      /* put @1 i binary3.;*/
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 Dec 2021 06:24:02 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-12-20T06:24:02Z</dc:date>
    <item>
      <title>How to create a format from concatenated values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786689#M40015</link>
      <description>&lt;P&gt;I'm trying to create the binary format &lt;STRONG&gt;binary3.&lt;/STRONG&gt; by concatenating the values 'binary', n, and '.', where n=3 is a value that will be read in from the data step (or possibly a macro variable).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far the following code doesn't work - it should output a list of binary values for the integers 1 through 8 in the log file. Any ideas what's wrong with my format statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;n = 3;&lt;BR /&gt;rows = 2**n;&lt;BR /&gt;/** construct one row at a time **/&lt;BR /&gt;format = cats('binary', char(n,1), '.');&lt;BR /&gt;do i = 1 to rows;&lt;BR /&gt;put @1 i format;&lt;BR /&gt;/* put @1 i binary3.;*/&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 04:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786689#M40015</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2021-12-20T04:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a format from concatenated values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786692#M40016</link>
      <description>&lt;P&gt;Only the putc/putn function allow dynamic formats.&lt;/P&gt;
&lt;P&gt;You could move the format-name to a macro-variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n = 3;
%let binaryformat = binary&amp;amp;n..;

data _null_;
   rows = 2**&amp;amp;n.;
   
   do i = 1 to rows;
      put i &amp;amp;binaryformat.;
      /* put @1 i binary3.;*/
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Dec 2021 06:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786692#M40016</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-12-20T06:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a format from concatenated values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786721#M40018</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  n = 3;
  rows = 2**n;
  /** construct one row at a time **/
  format = cats('binary', n, '.');
  do i = 1 to rows;
    b = putn(i, format);
    put @1 i b;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 12:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786721#M40018</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-12-20T12:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a format from concatenated values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786761#M40019</link>
      <description>Fantastic, thank you Andreas!</description>
      <pubDate>Mon, 20 Dec 2021 15:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786761#M40019</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2021-12-20T15:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a format from concatenated values?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786763#M40020</link>
      <description>Beautiful, thank you!</description>
      <pubDate>Mon, 20 Dec 2021 15:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-format-from-concatenated-values/m-p/786763#M40020</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2021-12-20T15:39:35Z</dc:date>
    </item>
  </channel>
</rss>

