<?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: Counting the number of variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23060#M5063</link>
    <description>why?</description>
    <pubDate>Mon, 17 May 2010 12:09:19 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2010-05-17T12:09:19Z</dc:date>
    <item>
      <title>Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23059#M5062</link>
      <description>Is there a way to count the number of variables in a dataset?&lt;BR /&gt;
Thanks.</description>
      <pubDate>Mon, 17 May 2010 11:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23059#M5062</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2010-05-17T11:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23060#M5063</link>
      <description>why?</description>
      <pubDate>Mon, 17 May 2010 12:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23060#M5063</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-05-17T12:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23061#M5064</link>
      <description>The output dataset of my code should have a defined number of variables (after various merge operations). I want to build an error check which displays the number of variables in the output data. Thanks.</description>
      <pubDate>Mon, 17 May 2010 12:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23061#M5064</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2010-05-17T12:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23062#M5065</link>
      <description>3078  data a;&lt;BR /&gt;
3079    a = 10;&lt;BR /&gt;
3080    label a = "number";&lt;BR /&gt;
3081    b = vlabel(a);&lt;BR /&gt;
3082&lt;BR /&gt;
3083  run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The data set WORK.A has 1 observations and 2 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
3084&lt;BR /&gt;
3085  data _null_;&lt;BR /&gt;
3086    set sashelp.vtable;&lt;BR /&gt;
3087    where libname ="WORK" AND memname = upcase("a");&lt;BR /&gt;
3088    put "nu of var=" nvar;&lt;BR /&gt;
3089  run;&lt;BR /&gt;
&lt;BR /&gt;
nu of var=2</description>
      <pubDate>Mon, 17 May 2010 13:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23062#M5065</guid>
      <dc:creator>P_J</dc:creator>
      <dc:date>2010-05-17T13:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23063#M5066</link>
      <description>after the step where table lib.your_table is wriitten, you can put the number of columns into a macro variable (&amp;amp;n_columns) with the syntax[pre]%let n_columns = none ;&lt;BR /&gt;
   proc sql noprint ;&lt;BR /&gt;
      select nVar &lt;BR /&gt;
        into :n_columns separated by ' '&lt;BR /&gt;
        from dictionary.tables&lt;BR /&gt;
       where libname= 'LIB'&lt;BR /&gt;
           &amp;amp; memname= 'YOUR_TABLE'&lt;BR /&gt;
    ;&lt;BR /&gt;
   quit ;&lt;BR /&gt;
%put your_table has &amp;amp;n_columns columns ;[/pre]If the table does not exist, the macro variable n_columns will hold "none".</description>
      <pubDate>Mon, 17 May 2010 13:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23063#M5066</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-05-17T13:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23064#M5067</link>
      <description>Excellent solution! Thanks P.J.&lt;BR /&gt;
&lt;BR /&gt;
V</description>
      <pubDate>Mon, 17 May 2010 13:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23064#M5067</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2010-05-17T13:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23065#M5068</link>
      <description>Many Thanks, Peter.</description>
      <pubDate>Mon, 17 May 2010 13:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-the-number-of-variables/m-p/23065#M5068</guid>
      <dc:creator>VD</dc:creator>
      <dc:date>2010-05-17T13:35:59Z</dc:date>
    </item>
  </channel>
</rss>

