<?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 How do I set a constant that I can use in file names for import and processes? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579656#M164560</link>
    <description>&lt;P&gt;I'm writing a code that imports lots of CSVs from the same folder, and then names them corresponding to the folder name (as the files are date-specific). I've tried a couple of things but was hoping for some input. This is one of the initial pieces of code:&lt;/P&gt;&lt;PRE&gt;PROC IMPORT DATAFILE='X://Projects/SAS/CSVs/_2019_05_16/0_C.csv'
    REPLACE DBMS=CSV OUT=Data._2019_05_16_T0;
    GETNAMES=YES;
    guessingrows=max;
RUN;&lt;/PRE&gt;&lt;P&gt;Here's the sort of idea I was hoping to have, but obviously it's not working currently:&lt;/P&gt;&lt;PRE&gt;folder_reference=_2019_05_16;

proc import datafile='X://Projects/SAS/CSVs/'&amp;amp;folder_reference&amp;amp;'/0_C.csv'
    replace DMBS=CSV out=Data.folder_reference&amp;amp;_T0
    getnames=yes;
    guessingrows=max;
run;&lt;/PRE&gt;&lt;P&gt;Do I have to put it in a macro format? I've tried to keep macro usage to a minimum in this code as those less fluent in SAS need to use this code too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2019 13:30:46 GMT</pubDate>
    <dc:creator>millerm</dc:creator>
    <dc:date>2019-08-07T13:30:46Z</dc:date>
    <item>
      <title>How do I set a constant that I can use in file names for import and processes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579656#M164560</link>
      <description>&lt;P&gt;I'm writing a code that imports lots of CSVs from the same folder, and then names them corresponding to the folder name (as the files are date-specific). I've tried a couple of things but was hoping for some input. This is one of the initial pieces of code:&lt;/P&gt;&lt;PRE&gt;PROC IMPORT DATAFILE='X://Projects/SAS/CSVs/_2019_05_16/0_C.csv'
    REPLACE DBMS=CSV OUT=Data._2019_05_16_T0;
    GETNAMES=YES;
    guessingrows=max;
RUN;&lt;/PRE&gt;&lt;P&gt;Here's the sort of idea I was hoping to have, but obviously it's not working currently:&lt;/P&gt;&lt;PRE&gt;folder_reference=_2019_05_16;

proc import datafile='X://Projects/SAS/CSVs/'&amp;amp;folder_reference&amp;amp;'/0_C.csv'
    replace DMBS=CSV out=Data.folder_reference&amp;amp;_T0
    getnames=yes;
    guessingrows=max;
run;&lt;/PRE&gt;&lt;P&gt;Do I have to put it in a macro format? I've tried to keep macro usage to a minimum in this code as those less fluent in SAS need to use this code too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 13:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579656#M164560</guid>
      <dc:creator>millerm</dc:creator>
      <dc:date>2019-08-07T13:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set a constant that I can use in file names for import and processes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579658#M164562</link>
      <description>&lt;P&gt;Yes you could use macro language code, as the way you wrote the code will not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let folder_reference=_2019_05_16;

proc import datafile="X://Projects/SAS/CSVs/&amp;amp;folder_reference/0_C.csv"
    replace DMBS=CSV out=Data.&amp;amp;folder_reference._T0
    getnames=yes;
    guessingrows=max;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Aug 2019 13:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579658#M164562</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-07T13:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I set a constant that I can use in file names for import and processes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579659#M164563</link>
      <description>Didn't realise it was that easy, my attempts were massively overcomplicated... Thanks!</description>
      <pubDate>Wed, 07 Aug 2019 13:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-set-a-constant-that-I-can-use-in-file-names-for-import/m-p/579659#M164563</guid>
      <dc:creator>millerm</dc:creator>
      <dc:date>2019-08-07T13:40:36Z</dc:date>
    </item>
  </channel>
</rss>

