<?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 Condtional renaming or choosing of a dataset. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190447#M48040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not been programming for long and below is what I would like to do, but clearly the syntax is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table good as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from (case when date&amp;lt;'10/31/2014' then table1&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; else table2)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, depending on the date, I either want to pick table 1 or table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way of doing it could be name change, as in..... if date&amp;lt;'10/31/2014' then rename table1 to good else rename table2 to good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;J-C&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Nov 2014 22:09:41 GMT</pubDate>
    <dc:creator>J_C</dc:creator>
    <dc:date>2014-11-28T22:09:41Z</dc:date>
    <item>
      <title>Condtional renaming or choosing of a dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190447#M48040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not been programming for long and below is what I would like to do, but clearly the syntax is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table good as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from (case when date&amp;lt;'10/31/2014' then table1&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; else table2)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, depending on the date, I either want to pick table 1 or table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way of doing it could be name change, as in..... if date&amp;lt;'10/31/2014' then rename table1 to good else rename table2 to good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;J-C&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 22:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190447#M48040</guid>
      <dc:creator>J_C</dc:creator>
      <dc:date>2014-11-28T22:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Condtional renaming or choosing of a dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190448#M48041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this may be useful in selecting observations based on condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table good as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from table1 where date&amp;lt;'31OCT2014'd &lt;/P&gt;&lt;P&gt;union all&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from table2 where date&amp;gt;='31OCT2014'd;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 23:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190448#M48041</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-11-28T23:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Condtional renaming or choosing of a dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190449#M48042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If date is referring to today's date, you could use something like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro doit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table good as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&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 date()&amp;lt;'31OCT2014'd %then table1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else table2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%doit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 23:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190449#M48042</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-11-28T23:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Condtional renaming or choosing of a dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190450#M48043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your input and came up with this not along after posting the question.&lt;/P&gt;&lt;P&gt;Can you let me know if this works as well (obviously less efficient then yours)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fyi, &amp;amp;date. is already defined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _test;&lt;/P&gt;&lt;P&gt;if &amp;amp;date.&amp;lt;September then table_name= 'table 1';&lt;/P&gt;&lt;P&gt;else table_name='table 2';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql no print;&lt;/P&gt;&lt;P&gt;select table_name into:view_select&lt;/P&gt;&lt;P&gt;from _test;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table good as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from &amp;amp;view_select.&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to work so far, but do you see a case where it might fail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;J-C&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 23:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190450#M48043</guid>
      <dc:creator>J_C</dc:creator>
      <dc:date>2014-11-28T23:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Condtional renaming or choosing of a dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190451#M48044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what you're comparing with:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px; background-color: #ffffff;"&gt;if &amp;amp;date.&amp;lt;September&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2014 23:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190451#M48044</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-11-28T23:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Condtional renaming or choosing of a dataset.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190452#M48045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to what Art has noted:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Dates in SAS for comparison need to be in the form: "DDMONYYYY"d i.e. "01Jan2014"d, so your date of &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;10/31/2014&lt;/SPAN&gt; may need to be transformed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. You can create the macro variable directly in the first data step using call symput/x &lt;/P&gt;&lt;P&gt;Assuming &amp;amp;date is a SAS date then you could do something like the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data _test;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if month(&amp;amp;date.)&amp;lt;9 then call symputx('view_table', 'table 1)';&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;else call symputx('view_table', 'table 2');&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Nov 2014 02:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Condtional-renaming-or-choosing-of-a-dataset/m-p/190452#M48045</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-29T02:04:43Z</dc:date>
    </item>
  </channel>
</rss>

