<?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: How to remove ^M Junk values while converting sas dataset to flat file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743523#M232813</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you might have leading not printable characters in your dataset but it's not clear to me.&lt;/P&gt;
&lt;P&gt;Can you provide some raw data?&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 11:17:40 GMT</pubDate>
    <dc:creator>Oligolas</dc:creator>
    <dc:date>2021-05-25T11:17:40Z</dc:date>
    <item>
      <title>How to remove ^M Junk values while converting sas dataset to flat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743508#M232807</link>
      <description>&lt;P&gt;I need to convert a SAS dataset into text file. After converting into flat file, I am getting&amp;nbsp;&lt;CODE&gt;^M&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp; in one of the field (only single row). We are reading this file in python, and python treats it as a new line.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How this junk value can be handled at dataset level before converting into text file ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In Dataset it simply looks like missing value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In VI editor value look like this -&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;}0}0}^M}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 09:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743508#M232807</guid>
      <dc:creator>PRAVIN_JAIN</dc:creator>
      <dc:date>2021-05-25T09:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove ^M Junk values while converting sas dataset to flat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743523#M232813</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;you might have leading not printable characters in your dataset but it's not clear to me.&lt;/P&gt;
&lt;P&gt;Can you provide some raw data?&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 11:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743523#M232813</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-05-25T11:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove ^M Junk values while converting sas dataset to flat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743528#M232816</link>
      <description>&lt;P&gt;What is ^M?&amp;nbsp; Do you mean the two byte string '^M'? Or perhaps the single character '0D'x (also know as a carriage return)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either way remove the values from the field in your dataset before writing the values to the text file.&lt;/P&gt;
&lt;P&gt;Either change it to some other character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1 = translate(var1,' ','0d'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or remove it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var1 = compress(var1,'0d'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If something else is going on you need to provide more information.&amp;nbsp; For example the lines from the SAS log of the step that created the text file.&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 12:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743528#M232816</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-25T12:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove ^M Junk values while converting sas dataset to flat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743546#M232823</link>
      <description>&lt;P&gt;This looks like you crated a file wirth DOS line terminators (cariage return+linefeed) and looking at it in a Unix/Linux environment. Linux and UNIX consider the linefeed as the terminator, regarding and showing the carriage return (Ctrl-M) as part of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We do not now how you create the file but possibly a filename statement is involved. In that case you can use the TERMSTR option to influence the choice of line terminator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So determining on your situation the ^M may be a problem or not. Depending on what your plan is with the file if may be ok or it needs to go. SAS leaves it to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan./&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 13:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-M-Junk-values-while-converting-sas-dataset-to-flat/m-p/743546#M232823</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2021-05-25T13:30:03Z</dc:date>
    </item>
  </channel>
</rss>

