<?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: put the same excel file with different names in a folder in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716458#M27444</link>
    <description>&lt;P&gt;Thank you! is i am learning of course &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2021 14:13:10 GMT</pubDate>
    <dc:creator>mmea</dc:creator>
    <dc:date>2021-02-03T14:13:10Z</dc:date>
    <item>
      <title>put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716418#M27435</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;If i have an Excel "Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx" file&amp;nbsp; in a folder called F:\A&lt;/P&gt;
&lt;P&gt;and I want to put this exact file into folder F:\B but duplicated 6 times like this:&lt;/P&gt;
&lt;P&gt;"1_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx"&lt;/P&gt;
&lt;P&gt;"2_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx"&lt;/P&gt;
&lt;P&gt;"3_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx"&lt;/P&gt;
&lt;P&gt;"4_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx"&lt;/P&gt;
&lt;P&gt;"5_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx"&lt;/P&gt;
&lt;P&gt;"6_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a macro to do that?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 13:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716418#M27435</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T13:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716431#M27437</link>
      <description>&lt;P&gt;You will need to have x command enabled to get this to work. To verify if you have x command enabled. Try and execute this statement in a program editor. If your server runs on windows environment ,&amp;nbsp; &amp;nbsp;x "DIR";&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp; if your server runs on Linux environment ,&amp;nbsp; x "ls";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If code works above then you should be able to use example below. If it doesn't then you will need to speak to you SAS administrator to get x commands enabled for this to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options noxwait;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;/* x "copy C:\temp\book1.xlsx&amp;nbsp; C:\temp\book2.xlsx";&amp;nbsp; &amp;nbsp;or&amp;nbsp; */&lt;BR /&gt;rc= system("copy C:\temp\book1.xlsx C:\temp\book2.xlsx");&lt;BR /&gt;rc= system("copy C:\temp\book1.xlsx C:\temp\book3.xlsx");&lt;BR /&gt;rc= system("copy C:\temp\book1.xlsx C:\temp\book4.xlsx");&lt;BR /&gt;put rc=;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 13:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716431#M27437</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-02-03T13:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716438#M27438</link>
      <description>&lt;P&gt;Thanks the X "dir" works on my computer&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 13:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716438#M27438</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T13:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716441#M27439</link>
      <description>&lt;P&gt;Should i just replace my file name with the ones you have put in the code?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 13:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716441#M27439</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T13:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716442#M27440</link>
      <description>&lt;P&gt;Yes&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 14:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716442#M27440</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-02-03T14:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716444#M27441</link>
      <description>&lt;P&gt;Can you help me with the example file i showed .. im quite new in sas&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 14:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716444#M27441</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T14:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716455#M27442</link>
      <description>&lt;P&gt;Now unfortunately, you are not really learning anything if i do it all for you. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options noxwait;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;/* x "copy c:\temp\testdata.txt c:\temp\testdata_&amp;amp;date..txt";*/&lt;BR /&gt;rc= system("copy f:\a\Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx f:\b\1_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx");&lt;BR /&gt;rc= system("copy f:\a\Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx f:\b\2_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx");&lt;BR /&gt;rc= system("copy f:\a\Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx f:\b\3_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx");&lt;BR /&gt;rc= system("copy f:\a\Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx f:\b\4_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx");&lt;BR /&gt;rc= system("copy f:\a\Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx f:\b\5_Covid19_report &amp;amp;todaysdate. &amp;amp;time..xlsx");&lt;BR /&gt;put rc=;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would highly recommend you take some SAS training as even though I gave you the solution, you might end up with an error and won't be able to solve it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best thing to do is to try to make yourself as self-sufficient as possible and the only way to do this is with educational training.&amp;nbsp; We have several online training courses that you can choose from. Based on your coding question i would recommend you start with the Programming 1 class. There is a free e-learning version available which is a great starter course. From there I would recommend you also take the 2-day&amp;nbsp;Programming 2 class. Followed by a SAS 2-day Macro 1 class.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 14:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716455#M27442</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-02-03T14:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716456#M27443</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
/* x "copy C:\temp\book1.xlsx  C:\temp\book2.xlsx";   or  */
rc= system("copy F:\A\COVID-19  Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\B\1081_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\A\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\B\1082_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\A\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\B\1083_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\A\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\B\1084_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\A\COVID-19   Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\B\1085_COVID-19  Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
put rc=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i did this&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 14:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716456#M27443</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T14:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716458#M27444</link>
      <description>&lt;P&gt;Thank you! is i am learning of course &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 14:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716458#M27444</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T14:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716487#M27445</link>
      <description>&lt;P&gt;Unfortunealty it did not give any output, but neither any errors &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 15:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716487#M27445</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T15:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716495#M27446</link>
      <description>&lt;P&gt;The code worked for me, so not sure why your code isn't.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 15:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716495#M27446</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-02-03T15:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716497#M27447</link>
      <description>&lt;P&gt;i think it could be something with the x command? when i run th code it shows me the prompt and says that the file do not exist&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 15:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716497#M27447</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T15:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716498#M27448</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%let todaysDate = %sysfunc(today(), yymmdd10.);
%put &amp;amp;todaysDate;

data _null_;
ftime = intnx('hour',time(),0,'b');
cftime = compress(put(ftime,hhmm.),":");
call symputx("ftime",cftime);
run;

%put &amp;amp;=ftime.;

options noxwait;
data _null_;
rc= system("copy F:\Data\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1081_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\Data\COVID-19  Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1082_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\Data\\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1083_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\Data\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1084_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\Data\COVID-19  Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1085_COVID-19  Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
put rc=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I ran this&lt;/P&gt;
&lt;P&gt;it gives me no error, but no outputs&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 15:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716498#M27448</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-02-03T15:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: put the same excel file with different names in a folder</title>
      <link>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716534#M27449</link>
      <description>&lt;P&gt;Show the name of the file you are copying. Copy the name an paste it into a text box opened with the forum's &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;The text box is important because the main message windows on this forum will reformat text and may remove characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to be extremely careful with paths. The code you show here if the first copy worked the second wouldn't because you have a different number of spaces after COVID-19 in the second copy command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;rc= system("copy F:\Data\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1081_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");
rc= system("copy F:\Data\COVID-19  Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx 
           F:\brugere\1082_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx");&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hint: make the string represented by using something like:&lt;/P&gt;
&lt;P&gt;%put copy F:\Data\COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx &lt;BR /&gt;F:\brugere\1081_COVID-19 Report &amp;amp;todaysdate. &amp;amp;ftime..xlsx&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;Then copy that result from the log and paste into a command line box on your system.&lt;/P&gt;
&lt;P&gt;I suspect you may find that spaces in the path are part of the problem and you get to deal with quoting to make valid paths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   insert = "&amp;amp;todaysdate. &amp;amp;ftime.";
   length copystr targstr commandstr $ 200;
   copystr =  cats(catx(' ','copy "F:\Data\COVID-19 Report',insert),'.xlsx"');
   do loop = 1081 to 1085;
       targstr = Quote(cats(catx(' ',cats("F:\brugere\",loop,"_COVID-19 Report"),insert),".xlsx"));
       put copystr=;
       put targstr=;
       /* uncomment the following after testing the above*/
/*       rc = system (catx(' ',copystr, targstr));*/

   end; 
run;
&lt;/PRE&gt;
&lt;P&gt;copy some of the results of the PUT to see if they work with the copy command in a command window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or use the data step to write a command file with the text of the copy commands. Then, as a text, execute the command file from a command prompt/window and see what you get. When you have the syntax correct you could then use the X or SYSTEM to execute the batch file that was written. With care you would then have documentation of what was actually written.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you actually getting multiple of these files every day? If not you could simplify things a tad by using the source date followed by an * to reference the source file.&lt;/P&gt;
&lt;P&gt;With the Windows copy command if you specify a target directory (folder) with a source file then the same named file gets copied to the directory. So need to use the date or time at all in the target:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;copy c:\thisfolder\thatfolder\somefilename.xlsx c:\targetfolder&lt;/P&gt;
&lt;P&gt;will make of copy of "somefilename.xlsx" in folder c:\targetfolder&lt;/P&gt;
&lt;P&gt;Which should simplify things a bit and reduce places to make type errors.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 16:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/put-the-same-excel-file-with-different-names-in-a-folder/m-p/716534#M27449</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-03T16:58:00Z</dc:date>
    </item>
  </channel>
</rss>

