<?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: Change the \ to / in infile statement for UNIX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745204#M233558</link>
    <description>&lt;P&gt;You can always use the forward slash for file paths in SAS, even when running on Windows (where backslash is the norm).&amp;nbsp; No need to maintain two versions or detect the OS and switch between / and \.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So best practice: change your programs to use the forward slash and don't worry about it!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 14:47:38 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2021-06-02T14:47:38Z</dc:date>
    <item>
      <title>Change the \ to / in infile statement for UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745203#M233557</link>
      <description>&lt;P&gt;The below code has \ back slash in it's infile statement and while I run on UNIX it's not reading it. I have 20 similar programs like this. Is there any macro that I can convert the \ to / forward while running the program?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
 infile '.\example2.txt' truncover;
 input fname :$20. lname :$30. address1 :$50. address2 :$50. city :$40.
 state :$2. zip phone :$12.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Jun 2021 14:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745203#M233557</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-02T14:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change the \ to / in infile statement for UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745204#M233558</link>
      <description>&lt;P&gt;You can always use the forward slash for file paths in SAS, even when running on Windows (where backslash is the norm).&amp;nbsp; No need to maintain two versions or detect the OS and switch between / and \.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So best practice: change your programs to use the forward slash and don't worry about it!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 14:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745204#M233558</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-06-02T14:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Change the \ to / in infile statement for UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745215#M233562</link>
      <description>How can I change programmatically? I don't wish to do a manual correction.</description>
      <pubDate>Wed, 02 Jun 2021 15:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745215#M233562</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-02T15:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change the \ to / in infile statement for UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745225#M233565</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;How can I change programmatically? I don't wish to do a manual correction.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For 20 programs?&amp;nbsp; Just open them one by one and use the CHANGE or REPLACE command of your editor of choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If did want to write a program it should not be that hard.&amp;nbsp; First let's make an example program file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options parmcards=example;
filename example temp;

parmcards4;
data a;
 infile '.\example2.txt' truncover;
 input fname :$20. lname :$30. address1 :$50. address2 :$50. city :$40.
 state :$2. zip phone :$12.;
run;
;;;;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's run a step to convert the \ to /.&amp;nbsp; You might want to limit the change to just the INFILE statements.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename fixed temp;
data _null_;
  infile example;
  file fixed ;
  input;
  if left(upcase(_infile_))=:'INFILE' then _infile_=translate(_infile_,'/','\');
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;data a;
 infile './example2.txt' truncover;
 input fname :$20. lname :$30. address1 :$50. address2 :$50. city :$40.
 state :$2. zip phone :$12.;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 15:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745225#M233565</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-02T15:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change the \ to / in infile statement for UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745228#M233566</link>
      <description>&lt;P&gt;And while you are at it, I strongly recommend to replace the relative path with an absolute one. The current working directory depends on the way SAS is started, so you can't trust it to be what you expect. On UNIX, one usually puts files into the home directory, so you can always use $HOME.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 16:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745228#M233566</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-02T16:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change the \ to / in infile statement for UNIX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745232#M233568</link>
      <description>Just one last question. Since all the 20 .sas file are NOT in same folder. Do I have to give 20 filename statements?</description>
      <pubDate>Wed, 02 Jun 2021 16:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-the-to-in-infile-statement-for-UNIX/m-p/745232#M233568</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-02T16:11:06Z</dc:date>
    </item>
  </channel>
</rss>

