<?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: Update MS Access table in SAS daily import in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820166#M323699</link>
    <description>&lt;P&gt;If you set:&lt;/P&gt;
&lt;P&gt;options memname=Extend;&lt;/P&gt;
&lt;P&gt;then SAS can handle some non-standard table names. You would use a name literal, which is the name of the table in quotes followed by an n, example: 'Table name with spaces'n&amp;nbsp; this will also handle other non-standard characters such as dash or slash and such. However, there is still a limit of 32 characters inside the quotes.&lt;/P&gt;
&lt;P&gt;If the variable names inside the table aren't standard for SAS then you would add the option Validvarname=Any which would allow the same thing for variable names:&amp;nbsp; 'non-standard char*name'n&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend a step to rename such just to avoid all the typos you may have while writing code and forgetting one of the quotes or having a space between the quote and the n.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming that you have a library Somelib pointing to Access:&lt;/P&gt;
&lt;PRE&gt;data mylib.standard_name;
   set Somelib.'Nonstandard name'n;
run;&lt;/PRE&gt;
&lt;P&gt;Or proc copy. And then Proc Datasets or similar to modify the data set mylib.standard_name to rename any non-standard variables. Likely you will have to work with this manually to see the offending variables.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2022 22:58:45 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-06-23T22:58:45Z</dc:date>
    <item>
      <title>Update MS Access table in SAS daily import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820160#M323693</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried to use the following codes (from a website) to import 10 MS Access files and both worked but there were two issues:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have to run the codes for each of the10 files (2 tables each) separately.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;This has to be done on a daily basis.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;My questions:&lt;/P&gt;&lt;P&gt;Is there a way to manipulate the codes to automate the code/s to import all the tables together?&lt;/P&gt;&lt;P&gt;Can I automate the process so that I don't have to manually import the files daily?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the 2 codes below:&lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to odbc as savesdb&lt;BR /&gt;(required="driver=Microsoft Access Driver (*.mdb, *.accdb);&lt;BR /&gt;dbq=c:desktop\saves.accdb;");&lt;BR /&gt;create table table1_copy as&lt;BR /&gt;select&lt;BR /&gt;*&lt;BR /&gt;from&lt;BR /&gt;connection to savesdb&lt;BR /&gt;(select * from table1);&lt;BR /&gt;disconnect from savesdb;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2.&lt;/P&gt;&lt;P&gt;libname savesdb odbc&lt;BR /&gt;required="driver=Microsoft Access Driver (*.mdb, *.accdb);&lt;BR /&gt;dbq=c:path\saves.accdb;";&lt;BR /&gt;data table1_copy;&lt;BR /&gt;set savesdb.table1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 21:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820160#M323693</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-06-23T21:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS Access table in SAS daily import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820161#M323694</link>
      <description>&lt;P&gt;It kind of depends on what you actually mean by "import".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you connect to an external data source with a LIBNAME statement as long as that is in effect you can get to the data in the library. So if you have multiple Libname statements, such as in your SAS set up to always execute when the session starts then those libraries are available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the names of the tables and files involved do not change you may be able to create a batch file that runs at a scheduled time ever day (such as before you start work) so they are done without any manual steps. These would be run best with a program scheduler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or a program that starts up every time you start SAS. Which approach might be preferred depends on how long it takes to execute. If the program steps run in a minute or two then when SAS starts might be best. If you need something to execute even when you are not there or the moving data around takes a notable amount of time then the scheduler with a batch program might be better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the file name or table names change then you are going to have a hard time reducing your current approach.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 21:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820161#M323694</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-23T21:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS Access table in SAS daily import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820164#M323697</link>
      <description>&lt;P&gt;Hi ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I just pressed on the solution tab instead of a reply. I'm not sure if you get my reply now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The names of the tables are just the same and do not change - I have a little issue there that the names have spaces and are not supported by SAS, but I'm trying to solve this through Access because I'm not sure if I can do that through SAS.&lt;/P&gt;&lt;P&gt;Both approaches that you recommended work for me. So is there any resource that help me in the programs you've mentioned?&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 22:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820164#M323697</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-06-23T22:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS Access table in SAS daily import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820166#M323699</link>
      <description>&lt;P&gt;If you set:&lt;/P&gt;
&lt;P&gt;options memname=Extend;&lt;/P&gt;
&lt;P&gt;then SAS can handle some non-standard table names. You would use a name literal, which is the name of the table in quotes followed by an n, example: 'Table name with spaces'n&amp;nbsp; this will also handle other non-standard characters such as dash or slash and such. However, there is still a limit of 32 characters inside the quotes.&lt;/P&gt;
&lt;P&gt;If the variable names inside the table aren't standard for SAS then you would add the option Validvarname=Any which would allow the same thing for variable names:&amp;nbsp; 'non-standard char*name'n&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend a step to rename such just to avoid all the typos you may have while writing code and forgetting one of the quotes or having a space between the quote and the n.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming that you have a library Somelib pointing to Access:&lt;/P&gt;
&lt;PRE&gt;data mylib.standard_name;
   set Somelib.'Nonstandard name'n;
run;&lt;/PRE&gt;
&lt;P&gt;Or proc copy. And then Proc Datasets or similar to modify the data set mylib.standard_name to rename any non-standard variables. Likely you will have to work with this manually to see the offending variables.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 22:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820166#M323699</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-23T22:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Update MS Access table in SAS daily import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820168#M323701</link>
      <description>&lt;P&gt;Thank you ballardw.&lt;/P&gt;&lt;P&gt;This helps. I'll try this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding the data import automation, is there any source that can help me create&amp;nbsp;&lt;SPAN&gt;a program that starts up every time I start SAS. I have no clue on how to do this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 23:11:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-MS-Access-table-in-SAS-daily-import/m-p/820168#M323701</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2022-06-23T23:11:13Z</dc:date>
    </item>
  </channel>
</rss>

