<?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: Problem with format and count working together in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736591#M229499</link>
    <description>&lt;P&gt;Many thanks! worked like a charm!&lt;/P&gt;</description>
    <pubDate>Fri, 23 Apr 2021 13:54:46 GMT</pubDate>
    <dc:creator>GustavSandberg</dc:creator>
    <dc:date>2021-04-23T13:54:46Z</dc:date>
    <item>
      <title>Problem with format and count working together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736587#M229496</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a macro to generate a non-fixed number of data-sets. I will have times when there are very few data-sets, and times when there are more (&amp;gt;100).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to transpose all these data-sets, and am therefore using a macro (%macro transp).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the call-statement for the data-set-generating-macro the format is "z1.", which only works for up to 9 data-sets. And if I have only 9 data-sets, the %macro transpose works.&lt;/P&gt;&lt;P&gt;If I have 10 or more data-sets, and change the format in the call-statement to z2. or z3., then the %macro transpose does not work. This is because the count-step in the beginning used 1,2,3 etc. and not 01, 02, 03 etc. which is generated by using z2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a format I should use instead, that will use 1,2,3,4... and up to several hundreds, without the 0's in front?&lt;/P&gt;&lt;P&gt;If not, is there a way to adjust the count-part of the macro, to count with 0's infront?&lt;/P&gt;&lt;P&gt;Or, any other suggestions on how to make it work when I have 10 or more data-sets?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	set list;
	string = catt('%import_file(', dir, ', ',  name,', ', catt('AAA', put(_n_, z1.)), ');');
	call execute (string);
	run;

%macro transp;
&lt;BR /&gt;proc sql noprint;
        select count(memname) into :num from dictionary.tables where libname='WORK' and memtype='DATA'
            and memname eqt "AAA";
quit;

%DO no=1 %TO &amp;amp;num.;
proc transpose
data=AAA&amp;amp;no. out=BBB&amp;amp;no. (drop=_name_ _label_);
id A;
var B;
run;
%END;

%mend;

%transp&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Apr 2021 13:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736587#M229496</guid>
      <dc:creator>GustavSandberg</dc:creator>
      <dc:date>2021-04-23T13:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with format and count working together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736590#M229498</link>
      <description>&lt;P&gt;If you can have more than 100 data sets, why not just use Z3. always?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then inside the macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%DO no=1 %TO &amp;amp;num.;
    %let zno = %sysfunc(putn(&amp;amp;no,z3.));
    proc transpose data=AAA&amp;amp;zno. out=BBB&amp;amp;zno. (drop=_name_ _label_);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 13:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736590#M229498</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-23T13:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with format and count working together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736591#M229499</link>
      <description>&lt;P&gt;Many thanks! worked like a charm!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 13:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-format-and-count-working-together/m-p/736591#M229499</guid>
      <dc:creator>GustavSandberg</dc:creator>
      <dc:date>2021-04-23T13:54:46Z</dc:date>
    </item>
  </channel>
</rss>

