<?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 Trying to create new tables through loops in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53909#M14921</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've read the post, but I am new to SAS; would you be able to explain what the hash does?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;data _null_ ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; dcl hash hh&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.definekey&amp;nbsp; ('k'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.definedata ('sex', 'name', 'age', 'height', 'weight') ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.definedone () ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; do until(mod(k,5)=0 or last);&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp; k+1;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp; set sashelp.class end=last ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp; hh.add();&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; gp+1;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.output(dataset: 'a'||strip(gp));&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in particularly dcl has hh, hh.define..., and mod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Feb 2012 20:53:49 GMT</pubDate>
    <dc:creator>leonh</dc:creator>
    <dc:date>2012-02-14T20:53:49Z</dc:date>
    <item>
      <title>Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53907#M14919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset which goes from 1990 to 2010; and for each year, there are few hundred observations. And I am trying to "partition" the dataset into different tables by year. I have the following, but I am pretty sure I can't do it, so what is the correct way to do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.test2;&lt;/P&gt;&lt;P&gt;do y=1989 to 2010;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set work.test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if year(date)=y;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 20:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53907#M14919</guid>
      <dc:creator>leonh</dc:creator>
      <dc:date>2012-02-14T20:15:21Z</dc:date>
    </item>
    <item>
      <title>Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53908#M14920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a number of ways to do what you want.&amp;nbsp; My preference is to use a hash.&amp;nbsp; Take a look at: &lt;A _jive_internal="true" href="https://communities.sas.com/message/102997#102997"&gt;http://communities.sas.com/message/102997#102997&lt;/A&gt; , particularly Ksharp's offering&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 20:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53908#M14920</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-14T20:18:54Z</dc:date>
    </item>
    <item>
      <title>Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53909#M14921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've read the post, but I am new to SAS; would you be able to explain what the hash does?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;data _null_ ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; dcl hash hh&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.definekey&amp;nbsp; ('k'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.definedata ('sex', 'name', 'age', 'height', 'weight') ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.definedone () ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; do until(mod(k,5)=0 or last);&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp; k+1;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp; set sashelp.class end=last ;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&amp;nbsp; hh.add();&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; gp+1;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp; hh.output(dataset: 'a'||strip(gp));&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in particularly dcl has hh, hh.define..., and mod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 20:53:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53909#M14921</guid>
      <dc:creator>leonh</dc:creator>
      <dc:date>2012-02-14T20:53:49Z</dc:date>
    </item>
    <item>
      <title>Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53910#M14922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, I have a question for you.&amp;nbsp; How many variables are in work.test and what are the variable names for each?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 21:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53910#M14922</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-14T21:00:18Z</dc:date>
    </item>
    <item>
      <title>Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53911#M14923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;there are 11, and they are permno, hexcd, date, ret, prc, shrout, gvkey, linkdt, linkenddt, bkvlps. And it is by the variable "date" that I watn to break into into monthly parititions. The data spans from 1990 to 2010, so effectively into 252 smaller tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 21:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53911#M14923</guid>
      <dc:creator>leonh</dc:creator>
      <dc:date>2012-02-14T21:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53912#M14924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 12pt;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; v1-v3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 12pt;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;01/02/1989 1 1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;02/01/1990 2 2 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;01/03/2010 3 3 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; year=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;1989&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%to&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;2010&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; month=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%to&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt; month=&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;(putn(&amp;amp;month,z2.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;data test&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 12pt;"&gt;year.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;amp;month;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;if year(date)=&amp;amp;year and month(date)=&amp;amp;month then &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%end&lt;/SPAN&gt;; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 12pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 12pt; background-color: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 12pt;"&gt;%&lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 21:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53912#M14924</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-02-14T21:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53913#M14925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the code that will accomplish the task using the hash method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp (index = (ym));&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ym=put(date,monyy7.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dcl hash hh&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; hh.definekey&amp;nbsp; ('k'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; hh.definedata ('ym','permno','hexcd','date','ret','prc',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'shrout','gvkey','linkdt','linkenddt','bkvlps') ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; hh.definedone () ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do k = 1 by 1 until ( last.ym ) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by ym ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hh.add () ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; hh.output(dataset: ym);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The following paper gives a nice overview of the method: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www2.sas.com/proceedings/sugi30/236-30.pdf"&gt;http://www2.sas.com/proceedings/sugi30/236-30.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and the following tipsheet gives a brief overview of all of the terms one might use: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/rnd/base/datastep/dot/hash-tip-sheet.pdf"&gt;http://support.sas.com/rnd/base/datastep/dot/hash-tip-sheet.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, the code is just creating an index of the values that you want to use to split the file, and then making use of your computer's memory to split the file based on the values stored in the index.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 21:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53913#M14925</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-14T21:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53914#M14926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! Both seems to work great! But a silly question (don't think it would be worth starting a new post), how would I create a variable that is equal to the maximum number of observations in the dataset (so actually this variable would be the same for every observation)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 21:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53914#M14926</guid>
      <dc:creator>leonh</dc:creator>
      <dc:date>2012-02-14T21:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53915#M14927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data class;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last then call symputx('n',_n_);&lt;/P&gt;&lt;P&gt;&amp;nbsp; max_obs=&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt; proc print; title there are &amp;amp;n obs. in dataset &amp;amp;syslast;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 22:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53915#M14927</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-02-14T22:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53916#M14928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are going to use Linlin's originally suggested method, you could get the number of observations in the same pass of the file if you replace the datastep with proc sql code.&amp;nbsp; E.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do year=1989 %to 2010;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do month=1 %to 12;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let month=%sysfunc(putn(&amp;amp;month,z2.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table test&amp;amp;year.&amp;amp;month. as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, count(*) as nobs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where year(date)=&amp;amp;year and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(date)=&amp;amp;month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 22:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53916#M14928</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-14T22:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53917#M14929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unless you are using a VIEW or other access type where SAS cannot calculate the number of observations then there is no need for the macro variable (unless you need it for the TITLE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data class ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set sashelp.class nobs=nobs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; max_obs=nobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that you need to assign it to a new variable as the one named in the SET statement is automatically dropped.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 23:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53917#M14929</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-14T23:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53918#M14930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Tom!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 23:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53918#M14930</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-02-14T23:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53919#M14931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you give me an idea about macro coding for problem:&lt;/P&gt;&lt;P&gt;I have for instance 31 daily tables with same name in a way: xxxxx01092013,...., xxxxxx30092013. how can I make elegant solution in macro language? I would like to create one table from these 30 tables without simple append procedure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best and thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 14:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53919#M14931</guid>
      <dc:creator>icicleana</dc:creator>
      <dc:date>2013-10-23T14:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53920#M14932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you don't have other tables in the same library starting with XXXXX then you could do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt; set XXXXX:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 14:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53920#M14932</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-10-23T14:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53921#M14933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you really ought to start a new discussion and, when you post it, provide more detail regarding what you have and what you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 14:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53921#M14933</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-23T14:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create new tables through loops</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53922#M14934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Linlin, Arthur and everyone, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin, thanks for the answer, but it is not so simple. I saw that you just created new one with setting older, but I have to manage with do list macro, and dates, such as:&lt;/P&gt;&lt;P&gt;let br=30&lt;/P&gt;&lt;P&gt;do %i=1 %to &amp;amp;br&lt;/P&gt;&lt;P&gt; %global datum&lt;/P&gt;&lt;P&gt;and something like put(dates.....???)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;br,datum&amp;amp;i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;something like that &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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is only part of loop. &lt;/P&gt;&lt;P&gt;I have 30&amp;nbsp; same tables ( same fields, but different values in it, name of one table is daily_product_01092013,...,daily_product_30092013) because in that tables we collect values from month to month and I would like to do append tables on cleverly way with macro coding ( I know to use EG and I now to use commands and tabs) &lt;/P&gt;&lt;P&gt;Best!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Oct 2013 06:43:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trying-to-create-new-tables-through-loops/m-p/53922#M14934</guid>
      <dc:creator>icicleana</dc:creator>
      <dc:date>2013-10-24T06:43:34Z</dc:date>
    </item>
  </channel>
</rss>

