<?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: Generic script for automated table creation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186200#M35293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm generating fake data that I can use to replicate your question. I generate a data set called table_names that has the names of the tables that I want to feed to the macro.&amp;nbsp; The call execute generates the macro call statements for each value of the table_name in the dataset table_names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Nov 2014 01:55:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-11-26T01:55:43Z</dc:date>
    <item>
      <title>Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186194#M35287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, this is my first time on sas community. I wrote this query to find some guidance on the topic of a generic script on which I'm working upon.&lt;/P&gt;&lt;P&gt;What I wanted to do through that script is to create tables in teradata, source being oracle.&lt;/P&gt;&lt;P&gt;To make it generic for a single table I wrote it like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro job(var); &lt;/P&gt;&lt;P&gt;Proc SQL;&lt;/P&gt;&lt;P&gt;Create table tera.&amp;amp;var as select * from ora.&amp;amp;var;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;%mend job();&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;%job(table name );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where tera and ora are libraries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do now is to make this script generic for 60 tables. &lt;/P&gt;&lt;P&gt;I will make a temporary data set in which I will store the 60 table names and want to call those table names in place of variable VAR one by one to create table in teradata.&lt;/P&gt;&lt;P&gt;Can any one please help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 17:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186194#M35287</guid>
      <dc:creator>Hercules</dc:creator>
      <dc:date>2014-11-25T17:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186195#M35288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look into call execute. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're table with names is table_names and variable is table_name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; print(data);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;proc print data= &amp;amp;data (obs=&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;run;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt; print;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; table_names;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;input&lt;/SPAN&gt; table_name &lt;SPAN style="color: #009193;"&gt;$20.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;cards&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;sashelp.class&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;sashelp.cars&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;sashelp.air&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;_null_&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;set&lt;/SPAN&gt; table_names;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;call&lt;/SPAN&gt; execute(&lt;SPAN style="color: #942193;"&gt;"%print("&lt;/SPAN&gt;||table_name|| &lt;SPAN style="color: #942193;"&gt;");"&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 17:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186195#M35288</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-25T17:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186196#M35289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or you could just use proc datasets or proc copy to copy the data sets over. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See &lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000247654.htm" title="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000247654.htm"&gt;Base SAS(R) 9.2 Procedures Guide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming the same table as above table_names exists:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select table_name into :extract_list separated by " "&lt;/P&gt;&lt;P&gt;from table_names;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets library=ora;&lt;/P&gt;&lt;P&gt;copy out=tera;&lt;/P&gt;&lt;P&gt;select &amp;amp;extract_list;&lt;/P&gt;&lt;P&gt;run; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 17:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186196#M35289</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-25T17:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186197#M35290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Reeza. &lt;/P&gt;&lt;P&gt;This was helpful. &lt;/P&gt;&lt;P&gt;But what I want to do is, I have created my table structures in teradata with 3 more audit columns. &lt;/P&gt;&lt;P&gt;So basically my proc sql statement will look like :&lt;/P&gt;&lt;P&gt;Proc sql;&lt;/P&gt;&lt;P&gt;Insert into Tera .table_name select *, monotonic(), job_id, datetime() from Ora.table_name ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think copy out teradata statement will work on this. &lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 18:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186197#M35290</guid>
      <dc:creator>Hercules</dc:creator>
      <dc:date>2014-11-25T18:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186198#M35291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then my first answer should work &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 18:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186198#M35291</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-25T18:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186199#M35292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please elaborate what actually this will do?&lt;/P&gt;&lt;P&gt;I do understand that you are creating a macro print for printing 10 observation. Then a dataset table_names having column as table_name.&lt;/P&gt;&lt;P&gt;But what does sashelp., sascar., cards And sasair. do?&lt;/P&gt;&lt;P&gt;Also the call execute statement?&lt;/P&gt;&lt;P&gt;Sorry for the trouble. It's only 3 weeks for me into sas programming. I tried to understand your logic but couldn't.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 01:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186199#M35292</guid>
      <dc:creator>Hercules</dc:creator>
      <dc:date>2014-11-26T01:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186200#M35293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm generating fake data that I can use to replicate your question. I generate a data set called table_names that has the names of the tables that I want to feed to the macro.&amp;nbsp; The call execute generates the macro call statements for each value of the table_name in the dataset table_names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 01:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186200#M35293</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-26T01:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186201#M35294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That awesomely worked. Thank you so much Reeza. Why dint I thought of it !!! :smileysilly:&lt;/P&gt;&lt;P&gt;grateful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 10:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186201#M35294</guid>
      <dc:creator>Hercules</dc:creator>
      <dc:date>2014-11-26T10:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186202#M35295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies for questioning you on the same subject. When I ran the first part of your code with and without the following macros output looks similar. I don't see the effect of these macros in subsequent steps. Also could you please advise how the call execute produces only ten observations without any explicit definitions over observations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #011993;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; print(data);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; background-color: #ffffff;"&gt;proc print data= &amp;amp;data (obs=&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009193;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #011993;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt; print;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 11:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186202#M35295</guid>
      <dc:creator>RamKumar</dc:creator>
      <dc:date>2014-11-26T11:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Generic script for automated table creation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186203#M35296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please ignore my question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 12:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generic-script-for-automated-table-creation/m-p/186203#M35296</guid>
      <dc:creator>RamKumar</dc:creator>
      <dc:date>2014-11-26T12:03:39Z</dc:date>
    </item>
  </channel>
</rss>

