<?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: Can pipe option and encoding= option take effects at the same time? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779939#M248451</link>
    <description>&lt;P&gt;The documentation for the FILENAME statement explicitly states:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Not all device types support the encoding option. For more information, see the documentation for your operating system.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;But there is no mention of a limitation on using ENCODING= with the PIPE device type in the Windows documentation. There probably should be.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 09:20:05 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2021-11-12T09:20:05Z</dc:date>
    <item>
      <title>Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779708#M248381</link>
      <description>&lt;P&gt;My operation system is encoding as EUC-CN and I work on SAS DMS in Unicode enviroment. I'm trying to write a program to get the directory of some path on my compute. My first version of code like this: &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path = %sysfunc(pathname(sasuser));
x dir "&amp;amp;path." /b/s &amp;gt; "&amp;amp;path.\_dir_.txt" &amp;amp; exit;

data test;
  infile "&amp;amp;path.\_dir_.txt" truncover encoding = 'zeuc';
  input path$1024.;
run;

x del "&amp;amp;path.\_dir_.txt" &amp;amp; exit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It works. But I think there is a more effective and beatiful way, so I rewrite it. My second version of code like this: &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  infile "dir ""&amp;amp;path."" /b/s" pipe truncover encoding = 'zeuc';
  input path$1024.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It's much shoter now, but is grammarly wrong:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR 23-2: option name "encoding" is invalid.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How do you think of that? Can pipe option and infile= option take effects at the same time?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 05:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779708#M248381</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2021-11-11T05:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779722#M248386</link>
      <description>&lt;P&gt;It seems that device &lt;EM&gt;pipe&lt;/EM&gt; and option &lt;EM&gt;encoding=&lt;/EM&gt;&amp;nbsp;cannot be used at the same time, though that is not specified in the documentation.&lt;/P&gt;
&lt;P&gt;You might want to ask tech support to have this clarified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is also a Feedback link all pages, including the relevant one:&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/1.0/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm#n0tskmdejsgmk0n1ex2dc5411mjk" target="_blank"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/1.0/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm#n0tskmdejsgmk0n1ex2dc5411mjk&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;They are usually very good at replying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the &lt;EM&gt;infile&lt;/EM&gt; statement not get the correct data if the encoding is not specified?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 07:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779722#M248386</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-11T07:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779732#M248392</link>
      <description>&lt;P&gt;Thanks, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The link doesn't describe the pipe and encoding inssue, perhaps I have to ask my tech support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pipe option actually pass the command, which is &lt;EM&gt;dir "&amp;amp;path." /b/s&lt;/EM&gt;, to the terminal of operation system(CMD for Windows). However, CMD's results are encoded as ANSI, for me, that means EUC-CN. So I'm reading a EUC-CN encoded file in unicode enviroment and I can't specify the encoding option. There are a lot of garbled characters in the result.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 08:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779732#M248392</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2021-11-11T08:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779735#M248393</link>
      <description>&lt;P&gt;The issue may be documented in a quite &lt;EM&gt;veiled&lt;/EM&gt; way:&lt;/P&gt;
&lt;P&gt;(from the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm" target="_blank" rel="noopener"&gt;INFILE Statement&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 class="xisDoc-argument"&gt;ENCODING= '&lt;EM class="xisDoc-userSuppliedValue"&gt;encoding-value&lt;/EM&gt;'&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;specifies the encoding to use when reading from &lt;STRONG&gt;the external file&lt;/STRONG&gt;.&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(emphasis by me)&lt;/P&gt;
&lt;P&gt;This could indicate that ENCODING= can only be used with files, and not other device types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although I see no technical reason for this, as the combination of PIPE and ENCODING= works in a FILENAME statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename test pipe "ls" encoding="WLATIN1";

data _null_;
infile test;
input;
put _infile_;
run;

filename test clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which means that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt;&amp;nbsp;can simplify the code by moving the PIPE option to the FILENAME statement, thereby avoiding the creation of the external file.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 08:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779735#M248393</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-11T08:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779746#M248394</link>
      <description>&lt;P&gt;Interesting&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;. I did try that before replying and this fails on Win64 with 9.4M7.&lt;/P&gt;
&lt;P&gt;So it might be that Unix behaves differently. All the more reason to ask Tech Support to sort this out, and to have the documentation amended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisNZ_0-1636623499363.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65585iCF3F26D262AA94C7/image-size/large?v=v2&amp;amp;px=999" role="button" title="ChrisNZ_0-1636623499363.png" alt="ChrisNZ_0-1636623499363.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 09:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779746#M248394</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-11T09:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779747#M248395</link>
      <description>&lt;P&gt;I still get the same error when I run your first line of program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my info of lab:&lt;BR /&gt;Version: SAS9.04.01M5&lt;/P&gt;
&lt;P&gt;Machine: SAS-Win10-0029 X64_10PRO&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anything wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 09:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779747#M248395</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2021-11-11T09:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779748#M248396</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; CMD's results are encoded as ANSI,&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt;&amp;nbsp;That's disappointing.&lt;/P&gt;
&lt;P&gt;Have you try loading the correct codepage? UTF-8 is&amp;nbsp;&lt;CODE&gt;65001&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;for example.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So you could try running something like&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;CODE&gt;chcp 65001 &amp;amp; dir "&amp;amp;path" /b/s&lt;/CODE&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;CODE&gt;chcp 65001&amp;gt;nul &amp;amp; dir "&amp;amp;path" /b/s&lt;/CODE&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 10:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779748#M248396</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-11T10:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779749#M248397</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt;&amp;nbsp;It seems this only works on Unix, not on Windows.&lt;/P&gt;
&lt;P&gt;Again, a good reason to seek clarification from tech support, and to request clarification of the doc.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 09:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779749#M248397</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-11T09:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779752#M248398</link>
      <description>&lt;P&gt;It is definitely an OS issue, because this also works on AIX:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile "ls" pipe encoding="WLATIN1";
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just did not think of testing it earlier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270406"&gt;@whymath&lt;/a&gt;&amp;nbsp;you should clearly check this with SAS technical support. If it is an issue with the way Windows handles pipes, then it should at least be documented.&lt;/P&gt;
&lt;P&gt;In the Windows companion, there is only an error message documented when ENCODING= is used with CARDS or DATALINES.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 11:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779752#M248398</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-11T11:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779867#M248434</link>
      <description>&lt;P&gt;This looks like a defect, it's very uncommon that such syntax is inconsistently supported across platforms.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 22:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779867#M248434</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-11T22:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779939#M248451</link>
      <description>&lt;P&gt;The documentation for the FILENAME statement explicitly states:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Not all device types support the encoding option. For more information, see the documentation for your operating system.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;But there is no mention of a limitation on using ENCODING= with the PIPE device type in the Windows documentation. There probably should be.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 09:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/779939#M248451</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2021-11-12T09:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/780086#M248524</link>
      <description>&lt;P&gt;Indeed. And such support depending o the OS is rather unusual. So this might not have happened on purpose.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Nov 2021 02:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/780086#M248524</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-13T02:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can pipe option and encoding= option take effects at the same time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/780091#M248528</link>
      <description>&lt;P&gt;Did you try doing the transcoding yourself?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  infile "&amp;amp;path.\_dir_.txt" truncover ;
  input path $1024.;
  path=kcvt(path,'zeuc','utf-8');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Nov 2021 04:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-pipe-option-and-encoding-option-take-effects-at-the-same/m-p/780091#M248528</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-13T04:32:00Z</dc:date>
    </item>
  </channel>
</rss>

