<?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: appending .csv files onto a dataset daily in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604117#M17029</link>
    <description>&lt;P&gt;So something like&amp;nbsp;&lt;STRONG&gt;sample_set_&amp;amp;today&lt;/STRONG&gt; is how you refer&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2019 14:38:52 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-11-14T14:38:52Z</dc:date>
    <item>
      <title>appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604096#M17021</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm really new to SAS and i am required to create a dataset that appends a csv file daily.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The csv file is dropped onto a location daily with the following naming convention: sample_set_20191114.csv&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way for me to run through the directory daily and automatically pick up and append the latest file to my 'sample' dataset using the date in the file name? or any other way to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All formats are exactly the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any reading material that could assist with this would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created the following example of a dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample;&lt;BR /&gt;infile '\\mylocation\sample.csv'&lt;BR /&gt;delimiter=','&lt;BR /&gt;missover&lt;BR /&gt;firstobs=2&lt;BR /&gt;DSD&lt;BR /&gt;lrecl = 32767;&lt;BR /&gt;&lt;BR /&gt;format make $7. ;&lt;BR /&gt;format model $15. ;&lt;BR /&gt;&lt;BR /&gt;input&lt;BR /&gt;make $&lt;BR /&gt;model $&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;run;&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>Thu, 14 Nov 2019 13:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604096#M17021</guid>
      <dc:creator>sophie07</dc:creator>
      <dc:date>2019-11-14T13:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604102#M17023</link>
      <description>&lt;P&gt;I&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220195"&gt;@sophie07&lt;/a&gt;&amp;nbsp; &amp;nbsp;Taking into account, your daily files have a date suffix formatted as yymmddn8.,A way to approach this by dynamic date macro.&lt;/P&gt;
&lt;P&gt;For example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;228  %let today=%sysfunc(today(),yymmddn8.);
229
230  %put &amp;amp;=today;
TODAY=20191114
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can add the &amp;amp;today suffix in your infile statement placeholder. So when the code executes on a daily basis, your macro variable will have that corresponding date&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 13:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604102#M17023</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-14T13:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604104#M17024</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks so much for the response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you explain how i do the append step?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry if this question doesnt make sense...this is probably my second time using SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or direct me to a forum that explains this would be great as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604104#M17024</guid>
      <dc:creator>sophie07</dc:creator>
      <dc:date>2019-11-14T14:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604105#M17025</link>
      <description>&lt;P&gt;I am assuming you would have done some online search on how to append SAS datasets. You could read about Proc append, using SET statements to append and so on. Since .csv is an external file, your 1st step is to convert the csv file to a SAS dataset or in other read into a SAS dataset form which you seem to have started with Infile and input. Then, once you have .csv in the form of a SAS dataset, you could use this dataset in the procedures mentioned to append.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro variable suggestion was just to make the process dynamic. Nonetheless, what you probably need is some reading and search online.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604105#M17025</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-14T14:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604108#M17026</link>
      <description>&lt;P&gt;i tried the &amp;amp;=today suffix in my infile step however, i get an error saying the physical file does not exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;not sure if i am doing something wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604108#M17026</guid>
      <dc:creator>sophie07</dc:creator>
      <dc:date>2019-11-14T14:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604109#M17027</link>
      <description>&lt;P&gt;Thanks so much! i managed to do the append but still not&amp;nbsp;&lt;SPAN&gt;dynamically.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;appreciate your responses!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604109#M17027</guid>
      <dc:creator>sophie07</dc:creator>
      <dc:date>2019-11-14T14:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604116#M17028</link>
      <description>&lt;P&gt;Use &amp;amp;today in your code . You can only use &amp;amp;=today only in %put statements&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604116#M17028</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-14T14:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604117#M17029</link>
      <description>&lt;P&gt;So something like&amp;nbsp;&lt;STRONG&gt;sample_set_&amp;amp;today&lt;/STRONG&gt; is how you refer&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604117#M17029</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-11-14T14:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604119#M17030</link>
      <description>&lt;P&gt;it worked! thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604119#M17030</guid>
      <dc:creator>sophie07</dc:creator>
      <dc:date>2019-11-14T14:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: appending .csv files onto a dataset daily</title>
      <link>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604120#M17031</link>
      <description>&lt;P&gt;Use proc append to add the daily data dynamically along with macro variable &amp;amp;today.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc import file="&amp;amp;path/&amp;amp;filename_&amp;amp;today..csv"&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;data=sample_&amp;amp;today.&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;/***your code here***/&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/****add daily file to your base i.e. sample (if you want to keep the history data and add daily incoming data&amp;nbsp; to this)***/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc append base=sample data=sample_&amp;amp;today. ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2019 14:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/appending-csv-files-onto-a-dataset-daily/m-p/604120#M17031</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2019-11-14T14:46:07Z</dc:date>
    </item>
  </channel>
</rss>

