<?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: Renaming a Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291368#M60373</link>
    <description>&lt;P&gt;Cody_Devl,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that you got your answer and I'll bet that you have already implemented it.&amp;nbsp; Great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have another idea that will address requirements #2 and #3 that may come in handy some day.&amp;nbsp; Consider creating Generation Data Groups for the data sets you want to modify.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; proc datasets&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;library=sgflib nolist; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&amp;nbsp; modify ColA(genmax=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&amp;nbsp; modify ColB(genmax=1&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, when you modify ColA or ColB, SAS will save the old copies as ColA#001, ColB#001, respectively and keep the modified versions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't take my word for it; check it out!&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2016 18:14:56 GMT</pubDate>
    <dc:creator>MMMIIIIKKKKEEEE</dc:creator>
    <dc:date>2016-08-12T18:14:56Z</dc:date>
    <item>
      <title>Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291266#M60349</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using SQL to build my datasets and get &lt;STRONG&gt;"warnings"&lt;/STRONG&gt; if the name of the modified new&amp;nbsp;dataset is the same as the original dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dataset&amp;nbsp;Old =&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ColA, ColB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dataset&amp;nbsp;New =&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ColA, ColB, ColC&lt;/P&gt;&lt;P&gt;(one attribute added)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I call the new dataset the same name as the name of the old dataset, I get a "warning" in the error log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is&amp;nbsp;a good&amp;nbsp;and simple technique to build my dataset out and&amp;nbsp;so that&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; I end&amp;nbsp;up with only one&amp;nbsp;dataset and&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; The result&amp;nbsp;has the name of the Original dataset (even if I have modified the&amp;nbsp;dataset 5 or 6 times) and&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; I can eliminate all of the warnings?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A simple example would help.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(when I research, I find much on renaming attributes but not much on datasets)&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;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>Fri, 12 Aug 2016 14:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291266#M60349</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-08-12T14:26:16Z</dc:date>
    </item>
    <item>
      <title>Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291263#M60351</link>
      <description>&lt;P&gt;I am using SQL to build my datasets and get &lt;STRONG&gt;"warnings"&lt;/STRONG&gt; if the name of the modified new&amp;nbsp;dataset is the same as the original dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dataset&amp;nbsp;Old =&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ColA, ColB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dataset&amp;nbsp;New =&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ColA, ColB, ColC&lt;/P&gt;&lt;P&gt;(one attribute added)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I call the new dataset the same name as the name of the old dataset, I get a "warning" in the error log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is&amp;nbsp;a good&amp;nbsp;and simple technique to build my dataset out and&amp;nbsp;so that&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; I end&amp;nbsp;up with only one&amp;nbsp;dataset and&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; The result&amp;nbsp;has the name of the Original dataset (even if I have modified the&amp;nbsp;dataset 5 or 6 times) and&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; I can eliminate all of the warnings?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;A simple example would help.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(when I research, I find much on renaming attributes but not much on datasets)&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;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>Fri, 12 Aug 2016 14:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291263#M60351</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-08-12T14:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291268#M60350</link>
      <description>&lt;P&gt;If your using multiple steps, use names that are unique to each step and then make a final dataset. You can use proc datasets to both remove extra data sets and to rename the final dataset if you'd like.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291268#M60350</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-12T14:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291272#M60352</link>
      <description>&lt;P&gt;The warning you get is telling you that writing to the same dataset that you read from will mean you cannot roll the changes back. &amp;nbsp;Its an SQL implementation thing. &amp;nbsp;You can put:&lt;/P&gt;
&lt;P&gt;proc sql undopolicy=none;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will remove the wraning. &amp;nbsp;However you may be better off just using datastep language - without seeing your process I can't really advise, but you can merge various datasets and do logic in one step:&lt;/P&gt;
&lt;PRE&gt;data want;
  set old:;
  colc="Hello World";
run;&lt;/PRE&gt;
&lt;P&gt;This would bring in all datasets in work with the prefix old, and create a new variable in the output want dataset.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291272#M60352</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-12T14:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291274#M60353</link>
      <description>&lt;P&gt;However NOT recommended, You can opt to data step to get rid of the warning.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data old;
set old;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if anything goes wrong (e.g. power outage), then you may lost your original data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;'s suggestion is dead on. Name it differently for every change you make, then using Proc dataset to clean the house, doing that guarantee you&amp;nbsp;easy trouble-shoot and better approach of programming.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 14:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291274#M60353</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-08-12T14:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291357#M60371</link>
      <description>&lt;P&gt;This Works couple with dropping the Old Dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 17:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291357#M60371</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-08-12T17:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming a Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291368#M60373</link>
      <description>&lt;P&gt;Cody_Devl,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that you got your answer and I'll bet that you have already implemented it.&amp;nbsp; Great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have another idea that will address requirements #2 and #3 that may come in handy some day.&amp;nbsp; Consider creating Generation Data Groups for the data sets you want to modify.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; proc datasets&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;library=sgflib nolist; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&amp;nbsp; modify ColA(genmax=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&amp;nbsp; modify ColB(genmax=1&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="1"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, when you modify ColA or ColB, SAS will save the old copies as ColA#001, ColB#001, respectively and keep the modified versions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't take my word for it; check it out!&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&lt;FONT face="Courier New,Courier New" size="1"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 18:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-a-Dataset/m-p/291368#M60373</guid>
      <dc:creator>MMMIIIIKKKKEEEE</dc:creator>
      <dc:date>2016-08-12T18:14:56Z</dc:date>
    </item>
  </channel>
</rss>

