<?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 variable for number of observations from 30 tables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/527037#M5197</link>
    <description>thank you so much, ballardw, it works perfect</description>
    <pubDate>Mon, 14 Jan 2019 19:09:11 GMT</pubDate>
    <dc:creator>changxuosu</dc:creator>
    <dc:date>2019-01-14T19:09:11Z</dc:date>
    <item>
      <title>how to create a variable for number of observations from 30 tables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526977#M5181</link>
      <description>&lt;P&gt;Dear SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question that needs your wisdom.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 30 tables, say Table1,table2,...table 30. All of them have the same data structure and the&amp;nbsp;same list of variables except that the&amp;nbsp;ith &amp;nbsp;table denotes the&amp;nbsp;month i.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I need to create a new table X, which is composed of two columns/variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first variable of table X is i, the index for table i; the second variable of table X&amp;nbsp;is the number of observations for table i.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does any one can point me to any idea/procedure/SAS macro that achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!!!&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>Mon, 14 Jan 2019 16:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526977#M5181</guid>
      <dc:creator>changxuosu</dc:creator>
      <dc:date>2019-01-14T16:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable for number of observations from 30 tables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526987#M5186</link>
      <description>&lt;P&gt;You can pull the dataset names and number of observations from dictionary.tables in SQL, or sashelp.vtable in a data step.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 16:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526987#M5186</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-14T16:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable for number of observations from 30 tables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526988#M5187</link>
      <description>&lt;P&gt;SASHELP.VTABLE is a table in SAS with metadata about the tables, you just need to filter it for the tables of interest. I would recommend opening the table first (sashelp.vtable) and looking at it, and then customizing your query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table myData as
select libname, memname, nobs
from sashelp.vtable
where upcase(memname) like 'TABLE%';
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SASHELP.VCOLUMN has data about each variable in a data set.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 17:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526988#M5187</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-14T17:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable for number of observations from 30 tables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526989#M5188</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/193702"&gt;@changxuosu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dear SAS community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question that needs your wisdom.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 30 tables, say Table1,table2,...table 30. All of them have the same data structure and the&amp;nbsp;same list of variables except that the&amp;nbsp;ith &amp;nbsp;table denotes the&amp;nbsp;month i.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I need to create a new table X, which is composed of two columns/variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first variable of table X is i, the index for table i; the second variable of table X&amp;nbsp;is the number of observations for table i.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does any one can point me to any idea/procedure/SAS macro that achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!!!&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;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By index do you mean the 1, 2, 3 etc that are suffixes to your table name? Or something related to a data set index?&lt;/P&gt;
&lt;P&gt;You can find a lot of information about table, including observations with something similar to&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table x as
   select *
   from dictionary.tables
   where libname='WORK' and memname like ('TABLE%')
   ;
run;&lt;/PRE&gt;
&lt;P&gt;The libname and memname values in the dictionary tables is stored in all upper case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your names are as simple as you indicate and you want the suffix value then you can get that by&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table x as
   select substr(memname,6),nobs
   from dictionary.tables
   where libname='WORK' and memname like ('TABLE%')
   ;
run;&lt;/PRE&gt;
&lt;P&gt;Obviously you want to reference the library your data sets exist in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 17:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/526989#M5188</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-14T17:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable for number of observations from 30 tables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/527037#M5197</link>
      <description>thank you so much, ballardw, it works perfect</description>
      <pubDate>Mon, 14 Jan 2019 19:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-create-a-variable-for-number-of-observations-from-30/m-p/527037#M5197</guid>
      <dc:creator>changxuosu</dc:creator>
      <dc:date>2019-01-14T19:09:11Z</dc:date>
    </item>
  </channel>
</rss>

