<?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: Reading from Unix in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307897#M20813</link>
    <description>Yes, it worked.&lt;BR /&gt;I've always heard spaces are a bad idea, but I've never had an issue with them, to be honest.</description>
    <pubDate>Fri, 28 Oct 2016 12:08:33 GMT</pubDate>
    <dc:creator>sleretrano</dc:creator>
    <dc:date>2016-10-28T12:08:33Z</dc:date>
    <item>
      <title>Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307696#M20800</link>
      <description>&lt;P&gt;Using EG 5.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to read from a compressed&amp;nbsp;Unix file using the following code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;CODE class=" language-sas"&gt;FILENAME Name pipe "zcat sas-data/SAD/SAD/IFRS 9/BASES/File_name.Z";

Data Test;

infile Name

lrecl=500000

DLM=':'

missover DSD;

label;

Run;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the output comes out looking like this:&lt;/P&gt;&lt;P&gt;&lt;IMG title="empty.jpg" alt="empty.jpg" src="https://communities.sas.com/t5/image/serverpage/image-id/5523iDD8237B3F52E48AA/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unziping the file and opening it directly, it looks like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;42000001251100:137224761:123272858:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:DW7 :P:CP :+002296660:+00000005300:+00000598760:+00000132500:+00000132500:+00000000000:+00000250000: &amp;nbsp; :00010101:ENC:20120314:ENC:20120215:0:502:00010101:20100914:20111027:+00000007300:119&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;42000002992100:176705643:184314704:+00000188769:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:PW7 :D:CP :+002123330:+00000008000:+00001768510:+00000200000:+00000200000:+00000001389:+00001566513:60:99991231:ENC:20150323:ENC:20150223:0:502:00010101:20141008:20130531:+00000005197:113&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;42000003721100:134284160:134284151:+00000138210:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:PW7 :D:CP :+002296660:+00000009000:+00001297485:+00000225000:+00000225000:+00000000970:+00000739335:68:20140114:ENC:20140704:RET:20140702:0:502:00010101:20121211:00010101:+00000000000:113&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this work?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 17:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307696#M20800</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-27T17:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307733#M20801</link>
      <description>&lt;P&gt;I see you have a space in the directory &lt;CODE&gt;&lt;FONT size="3"&gt;&lt;FONT face="Courier New"&gt;"IFRS 9" in the file path. Can you escape it with a backslash ("IFRS\ 9") and try again?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 18:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307733#M20801</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-10-27T18:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307735#M20802</link>
      <description>Also, that's a relative path... can you give it the full path, e.g. /home/user/username/...</description>
      <pubDate>Thu, 27 Oct 2016 19:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307735#M20802</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-10-27T19:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307851#M20803</link>
      <description>&lt;P&gt;I see two issues here&lt;/P&gt;
&lt;P&gt;- a relative path that probably won't work, because SAS will go looking for the file from the current directory, which is somewhere in the SAS configuration tree if the default setting has not been changed.&lt;/P&gt;
&lt;P&gt;- a blank in the filename&lt;/P&gt;
&lt;P&gt;BLANKS IN FILE OR PATH NAMES (on servers) ARE A BAD IDEA (repeat this 1k times)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME Name pipe 'zcat "/sas-data/SAD/SAD/IFRS 9/BASES/File_name.Z"';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the compressed file is actually somewhere up from your home directory, use $HOME instead of the leading slash.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 07:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307851#M20803</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-28T07:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307859#M20804</link>
      <description>I physically changed the path to remove the space and I tried FILENAME Name pipe 'zcat "/sas-data/SAD/SAD/IFRS9/BASES/File_name.Z"', but it still doesn't work. This particular line of code does run, it also ran in my original try, but when reading from the file it comes out empty. Any ideas?</description>
      <pubDate>Fri, 28 Oct 2016 08:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307859#M20804</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T08:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307861#M20805</link>
      <description>&lt;P&gt;Then try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME Name pipe 'zcat "/sas-data/SAD/SAD/IFRS9/BASES/File_name.Z" 2&amp;gt;&amp;amp;1';

data _null_;
infile name;
input;
put _infile_;
if _n_ &amp;gt; 10 then stop;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That should at least put error messages from the external command into the log.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 08:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307861#M20805</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-28T08:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307862#M20806</link>
      <description>17 data _null_;&lt;BR /&gt;18 infile name;&lt;BR /&gt;19 input;&lt;BR /&gt;20 put _infile_;&lt;BR /&gt;21 if _n_ &amp;gt; 10 then stop;&lt;BR /&gt;22 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: The infile NAME is:&lt;BR /&gt;Pipe command="zcat "/sas-data/SAD/SAD/IFRS9/BASES/File_name.Z" 2&amp;gt;&amp;amp;1"&lt;BR /&gt;&lt;BR /&gt;gzip: /sas-data/SAD/SAD/IFRS9/BASES/File_name.Z: No such file or directory&lt;BR /&gt;NOTE: 1 record was read from the infile NAME.&lt;BR /&gt;The minimum record length was 74.&lt;BR /&gt;The maximum record length was 74.&lt;BR /&gt;&lt;BR /&gt;I managed to make it work, though. I was missing the input option. Should I post what worked for me as an answer or what?</description>
      <pubDate>Fri, 28 Oct 2016 08:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307862#M20806</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T08:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307863#M20807</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80979"&gt;@sleretrano&lt;/a&gt; wrote:&lt;BR /&gt;17 data _null_;&lt;BR /&gt;18 infile name;&lt;BR /&gt;19 input;&lt;BR /&gt;20 put _infile_;&lt;BR /&gt;21 if _n_ &amp;gt; 10 then stop;&lt;BR /&gt;22 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: The infile NAME is:&lt;BR /&gt;Pipe command="zcat "/sas-data/SAD/SAD/IFRS9/BASES/File_name.Z" 2&amp;gt;&amp;amp;1"&lt;BR /&gt;&lt;BR /&gt;gzip: /sas-data/SAD/SAD/IFRS9/BASES/File_name.Z: No such file or directory&lt;BR /&gt;NOTE: 1 record was read from the infile NAME.&lt;BR /&gt;The minimum record length was 74.&lt;BR /&gt;The maximum record length was 74.&lt;BR /&gt;&lt;BR /&gt;I managed to make it work, though. I was missing the input option. Should I post what worked for me as an answer or what?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Oh, gosh. Should have noticed that missing input statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By all means, post the final solution for future reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The 2&amp;gt;&amp;amp;1 redirection of stderr to stdout is one of the most useful tricks when using external commands. I basically never use the x statement any longer in production jobs, I always use filename pipe with redirection, so I get error messages in the log or in files.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 08:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307863#M20807</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-28T08:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307882#M20808</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;FILENAME Name pipe "zcat sas-data/SAD/SAD/IFRS 9/BASES/File_name.Z";

Data Test;

infile Name

lrecl=500000

DLM=':'

missover DSD;

Input Var1-Var36;

Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The input statement was missing. The above fixes it.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 10:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307882#M20808</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T10:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307884#M20809</link>
      <description>No idea of what you're talking about. Can you please refer me to some intro to that?&lt;BR /&gt;Thank you for everything.</description>
      <pubDate>Fri, 28 Oct 2016 10:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307884#M20809</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T10:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307885#M20810</link>
      <description>&lt;P&gt;So the compressed data file really resides in a path relative to the current working directory of the SAS workspace server process.&lt;/P&gt;
&lt;P&gt;And it worked just like that, with an unmasked blank in the file name?&lt;/P&gt;
&lt;P&gt;I ask that because on my UNIX that results in zcat trying to unzip two separate files. From the commandline and from SAS.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 10:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307885#M20810</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-28T10:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from Unix</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307897#M20813</link>
      <description>Yes, it worked.&lt;BR /&gt;I've always heard spaces are a bad idea, but I've never had an issue with them, to be honest.</description>
      <pubDate>Fri, 28 Oct 2016 12:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/m-p/307897#M20813</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T12:08:33Z</dc:date>
    </item>
  </channel>
</rss>

