<?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: trouble generating a fix file with character ñ in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920564#M362558</link>
    <description>&lt;P&gt;The encoding latin1 did not work, I've got the same problem&lt;/P&gt;</description>
    <pubDate>Sat, 16 Mar 2024 16:49:25 GMT</pubDate>
    <dc:creator>Jose7</dc:creator>
    <dc:date>2024-03-16T16:49:25Z</dc:date>
    <item>
      <title>trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920558#M362554</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm generating a fix file, using a sintaxis like this&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;set filexyz;&lt;BR /&gt;file '/data/filexyz' TERMSTR=crlf;&lt;/P&gt;
&lt;P&gt;put&lt;BR /&gt;@1 account z10.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; namex $20.&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75709"&gt;@31&lt;/a&gt; branch&amp;nbsp; z5.&lt;BR /&gt;and the result is something like this:&lt;/P&gt;
&lt;P&gt;1234&amp;nbsp; &amp;nbsp; &amp;nbsp; Robert A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 56789&lt;/P&gt;
&lt;P&gt;1234&amp;nbsp; &amp;nbsp; &amp;nbsp; Robert B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 56788&lt;/P&gt;
&lt;P&gt;as you can see there are 35 characters fixed, but when&amp;nbsp; ñ appears in the name, the result of the length of line is 34 characters&lt;/P&gt;
&lt;P&gt;1234&amp;nbsp; &amp;nbsp; &amp;nbsp; Robert Ñ&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;56788&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate too much your help, if you have any idea to solve it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 16:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920558#M362554</guid>
      <dc:creator>Jose7</dc:creator>
      <dc:date>2024-03-16T16:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920559#M362555</link>
      <description>&lt;P&gt;To generate a fixed position text file you need to use single byte encoding. Multiple byte encodings like UTF-8 will need to use multiple bytes to store non-ASCII characters, like the enye in your example, which will mess up the column count.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;file '/data/filexyz' TERMSTR=crlf encoding=latin1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Mar 2024 16:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920559#M362555</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-16T16:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920560#M362556</link>
      <description>&lt;P&gt;Example of input and the code you actually use to "fix" would be appropriate.&lt;/P&gt;
&lt;P&gt;Also, what is it supposed to be "fixed" to? We can't tell what isn't working without knowing what is attempted.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 16:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920560#M362556</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-16T16:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920563#M362557</link>
      <description>I get the same issue with latin1, It doesn´t solve the problem&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 16 Mar 2024 16:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920563#M362557</guid>
      <dc:creator>Jose7</dc:creator>
      <dc:date>2024-03-16T16:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920564#M362558</link>
      <description>&lt;P&gt;The encoding latin1 did not work, I've got the same problem&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 16:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920564#M362558</guid>
      <dc:creator>Jose7</dc:creator>
      <dc:date>2024-03-16T16:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920565#M362559</link>
      <description>&lt;P&gt;It´s simple, i´m trying to generate all the lines 35 length, and the lines are 34 length when ñ appears as a letter of&amp;nbsp; the name&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 16:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920565#M362559</guid>
      <dc:creator>Jose7</dc:creator>
      <dc:date>2024-03-16T16:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: trouble generating a fix file with character ñ</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920571#M362560</link>
      <description>&lt;P&gt;You will need to provide much more details about what you tried and what result you got.&amp;nbsp; Show the code used to create the text file.&amp;nbsp; And the code used to read the text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First what encoding is your SAS session using?&amp;nbsp; Check the value of the ENCODING system option.&amp;nbsp; That option is set at the start of the SAS session, so you need to make sure you are using an single byte encoding for the SAS session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to read a text file and you do not want SAS to transcode the characters from the encoding used by the file to encoding used by the SAS session then you will need to use ENCODING=ANY on the INFILE statement.&amp;nbsp; Then if you did need to transcode the strings read from the file you will need to use the KCVT() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general you should not be writing non-ASCII characters into fixed position files.&amp;nbsp; It will just cause havoc.&amp;nbsp; Can you just not allow character like enye in your text strings?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also try reading the file as BINARY bytes to see what it contains.&amp;nbsp; For example to check the first 500 bytes of the file you could use a data step like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.txt' recfm=f lrecl=100 obs=5;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Mar 2024 18:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-generating-a-fix-file-with-character-%C3%B1/m-p/920571#M362560</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-16T18:43:40Z</dc:date>
    </item>
  </channel>
</rss>

