<?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 an external file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25053#M5658</link>
    <description>Hello all,&lt;BR /&gt;
&lt;BR /&gt;
Just to let you know I did get help from outside the Forums and found the code I am writing it here for those who are curious to know. &lt;BR /&gt;
&lt;BR /&gt;
options noxwait noxsync;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
       do i = 1 to 2;&lt;BR /&gt;
               dosCommand="copy c:\cdm1\command.inp c:\cdm1\CDM" || strip(i) || ".INP";&lt;BR /&gt;
               put dosCommand;&lt;BR /&gt;
               call system(dosCommand);&lt;BR /&gt;
&lt;BR /&gt;
       end;&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 09 Mar 2011 16:23:52 GMT</pubDate>
    <dc:creator>R_A_G_</dc:creator>
    <dc:date>2011-03-09T16:23:52Z</dc:date>
    <item>
      <title>renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25046#M5651</link>
      <description>Hello SAS Experts,&lt;BR /&gt;
&lt;BR /&gt;
I have a data file in my c directory named which I need to duplicate and rename.&lt;BR /&gt;
&lt;BR /&gt;
The old data in "C" directory:&lt;BR /&gt;
&lt;BR /&gt;
C:\CDM1\command.dat&lt;BR /&gt;
&lt;BR /&gt;
I need to rplicate this to 100 files named :&lt;BR /&gt;
&lt;BR /&gt;
C:\CDM1\CDM_1&lt;BR /&gt;
C:\CDM1\CDM_2&lt;BR /&gt;
C:\CDM1\CDM_3&lt;BR /&gt;
C:\CDM1\CDM_4&lt;BR /&gt;
and so on.&lt;BR /&gt;
&lt;BR /&gt;
I appreciate any help.&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
RG</description>
      <pubDate>Tue, 08 Mar 2011 19:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25046#M5651</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-08T19:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25047#M5652</link>
      <description>Look at using the CALL SYSTEM function from a DATA step -- you generate your OS command syntax.  Recommend reviewing the particulars in the OS-specific SAS "companion" guide available on the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website, where you will find SAS-hosted DOC but also supplemental technical and conference reference material, available using the website SEARCH or an Internet search engine.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
call system site:sas.com &lt;BR /&gt;
&lt;BR /&gt;
execute os commands site:sas.com</description>
      <pubDate>Tue, 08 Mar 2011 20:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25047#M5652</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-03-08T20:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25048#M5653</link>
      <description>Hello R.A.G&lt;BR /&gt;
&lt;BR /&gt;
This is a solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
libname i "C:\CDM1";&lt;BR /&gt;
%macro a;&lt;BR /&gt;
  %do i=1 %to 100;&lt;BR /&gt;
    data i.CDM_&amp;amp;i;&lt;BR /&gt;
      set i.command;&lt;BR /&gt;
    run;&lt;BR /&gt;
  %end;&lt;BR /&gt;
%mend a; &lt;BR /&gt;
.%a&lt;BR /&gt;
[/pre]&lt;BR /&gt;
The only question: is a command.dat a SAS dataset? If yes then this is the solution.&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 08 Mar 2011 20:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25048#M5653</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-08T20:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25049#M5654</link>
      <description>Thank you SPR</description>
      <pubDate>Wed, 09 Mar 2011 01:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25049#M5654</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-09T01:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25050#M5655</link>
      <description>The only problem is that command is a .dat file &lt;BR /&gt;
Thank you &lt;BR /&gt;
RG</description>
      <pubDate>Wed, 09 Mar 2011 03:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25050#M5655</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-09T03:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25051#M5656</link>
      <description>Hi.If your OS is Windows.&lt;BR /&gt;
How about:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   file 'c:\copy.bat';&lt;BR /&gt;
   do i=1 to 10;&lt;BR /&gt;
    str=cats("copy c:\class.txt c:\class",i,".txt");&lt;BR /&gt;
    put str;&lt;BR /&gt;
   end;&lt;BR /&gt;
run; &lt;BR /&gt;
    x "c:\copy.bat";&lt;BR /&gt;
    x "del c:\copy.bat";&lt;BR /&gt;
 run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 09 Mar 2011 07:09:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25051#M5656</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-09T07:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25052#M5657</link>
      <description>thanks KSharp, &lt;BR /&gt;
but No it doesn't work. It takes my command.INP file and wipes everything in it and turns it into a text file with these writen in it. &lt;BR /&gt;
copy c:\command.inp c:\class1.inp&lt;BR /&gt;
copy c:\command.inp c:\class2.inp&lt;BR /&gt;
copy c:\command.inp c:\class3.inp&lt;BR /&gt;
copy c:\command.inp c:\class4.inp&lt;BR /&gt;
copy c:\command.inp c:\class5.inp&lt;BR /&gt;
copy c:\command.inp c:\class6.inp&lt;BR /&gt;
copy c:\command.inp c:\class7.inp&lt;BR /&gt;
copy c:\command.inp c:\class8.inp&lt;BR /&gt;
copy c:\command.inp c:\class9.inp&lt;BR /&gt;
copy c:\command.inp c:\class10.inp&lt;BR /&gt;
&lt;BR /&gt;
copy c:\command.txt c:\class10.inp</description>
      <pubDate>Wed, 09 Mar 2011 16:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25052#M5657</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-09T16:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25053#M5658</link>
      <description>Hello all,&lt;BR /&gt;
&lt;BR /&gt;
Just to let you know I did get help from outside the Forums and found the code I am writing it here for those who are curious to know. &lt;BR /&gt;
&lt;BR /&gt;
options noxwait noxsync;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
       do i = 1 to 2;&lt;BR /&gt;
               dosCommand="copy c:\cdm1\command.inp c:\cdm1\CDM" || strip(i) || ".INP";&lt;BR /&gt;
               put dosCommand;&lt;BR /&gt;
               call system(dosCommand);&lt;BR /&gt;
&lt;BR /&gt;
       end;&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 09 Mar 2011 16:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25053#M5658</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-09T16:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25054#M5659</link>
      <description>Sigh..........&lt;BR /&gt;
I only give you an example.&lt;BR /&gt;
The only thing you need change is to change pathe and filename.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   file 'c:\copy.bat';&lt;BR /&gt;
   do i=1 to 10;&lt;BR /&gt;
    str=cats("copy &lt;B&gt;c:\cdm1\command.dat c:\cdm1\cdm_",i,".dat"&lt;/B&gt;);&lt;BR /&gt;
    put str;&lt;BR /&gt;
   end;&lt;BR /&gt;
run; &lt;BR /&gt;
    x "c:\copy.bat";&lt;BR /&gt;
    x "del c:\copy.bat";&lt;BR /&gt;
 run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 10 Mar 2011 03:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25054#M5659</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-10T03:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: renaming an external file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25055#M5660</link>
      <description>call system() is very boring because after executing call system every time you need to close the windows manually.&lt;BR /&gt;
&lt;BR /&gt;
When you need 100 files ,then you need close the command windows manually for a hundreds times. Are you feeling tired with your finger? &lt;BR /&gt;
&lt;BR /&gt;
And my code is only to close &lt;B&gt;one&lt;/B&gt; command windows.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 10 Mar 2011 03:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/renaming-an-external-file/m-p/25055#M5660</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-10T03:52:45Z</dc:date>
    </item>
  </channel>
</rss>

