<?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 C# SAS V5 generator numeric value issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/C-SAS-V5-generator-numeric-value-issue/m-p/504108#M134863</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm creating a C# SAS V5 generator (.xpt files).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output files are stored in .xpt and encoded in ISO-8859-1 (1252 code).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed all the SAS documentation for well exporting but i'm facing some problems with my numbers conversion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g., when converting C# int into their floating-point representation, i got some mistakes. I have a unit test exporting my data in .xpt format, then I load them into SAS and read it with %xpt2loc maccro. For sequence number, my 8 is read as "3.9375", my 16 as "A".. It's not random mistakes, it's always the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with Alan Churchill C# converter (december 2012) -&amp;nbsp;&lt;A href="https://www.codeproject.com/Articles/492449/Transform-between-IEEE-IBM-or-VAX-floating-point" target="_blank"&gt;https://www.codeproject.com/Articles/492449/Transform-between-IEEE-IBM-or-VAX-floating-point&lt;/A&gt; , or maybe you have an other solution ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample of my code,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var converter = new Converter();&lt;BR /&gt;converter.Process(Endian.BigEndian);&lt;BR /&gt;var bytes = converter.ConvertDoubleToBytes(Platform.IbmFloat, (double)data_);&lt;BR /&gt;var byteString = Encoding.GetEncoding(1252).GetString(bytes);&lt;BR /&gt;return PadString(byteString, _fieldSizes[index_]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for a numeric var, _fieldSizes[index_] is always equals to 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help.&lt;/P&gt;</description>
    <pubDate>Sun, 14 Oct 2018 16:48:24 GMT</pubDate>
    <dc:creator>lle</dc:creator>
    <dc:date>2018-10-14T16:48:24Z</dc:date>
    <item>
      <title>C# SAS V5 generator numeric value issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/C-SAS-V5-generator-numeric-value-issue/m-p/504108#M134863</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm creating a C# SAS V5 generator (.xpt files).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output files are stored in .xpt and encoded in ISO-8859-1 (1252 code).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I followed all the SAS documentation for well exporting but i'm facing some problems with my numbers conversion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;E.g., when converting C# int into their floating-point representation, i got some mistakes. I have a unit test exporting my data in .xpt format, then I load them into SAS and read it with %xpt2loc maccro. For sequence number, my 8 is read as "3.9375", my 16 as "A".. It's not random mistakes, it's always the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with Alan Churchill C# converter (december 2012) -&amp;nbsp;&lt;A href="https://www.codeproject.com/Articles/492449/Transform-between-IEEE-IBM-or-VAX-floating-point" target="_blank"&gt;https://www.codeproject.com/Articles/492449/Transform-between-IEEE-IBM-or-VAX-floating-point&lt;/A&gt; , or maybe you have an other solution ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a sample of my code,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var converter = new Converter();&lt;BR /&gt;converter.Process(Endian.BigEndian);&lt;BR /&gt;var bytes = converter.ConvertDoubleToBytes(Platform.IbmFloat, (double)data_);&lt;BR /&gt;var byteString = Encoding.GetEncoding(1252).GetString(bytes);&lt;BR /&gt;return PadString(byteString, _fieldSizes[index_]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for a numeric var, _fieldSizes[index_] is always equals to 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Oct 2018 16:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/C-SAS-V5-generator-numeric-value-issue/m-p/504108#M134863</guid>
      <dc:creator>lle</dc:creator>
      <dc:date>2018-10-14T16:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: C# SAS V5 generator numeric value issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/C-SAS-V5-generator-numeric-value-issue/m-p/504136#M134871</link>
      <description>&lt;P&gt;Interesting endeavour.&lt;BR /&gt;Sorry I can't help you, but reading your question raised a few thoughts.&lt;BR /&gt;1. I would start with a SAS-encoded file and see what the output for your data is.&lt;BR /&gt;2. Did you read &lt;A href="https://communities.sas.com/t5/SAS-Programming/Creating-SAS-XPT-file/td-p/329145" target="_self"&gt;this &lt;/A&gt;and&amp;nbsp;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Please-help-validating-my-SAS-XPORT-file/td-p/389736" target="_self"&gt;this&lt;/A&gt;? Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/160085"&gt;@BarbaraPost&lt;/a&gt;&amp;nbsp;can help.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Oct 2018 22:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/C-SAS-V5-generator-numeric-value-issue/m-p/504136#M134871</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-10-14T22:01:23Z</dc:date>
    </item>
  </channel>
</rss>

