<?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: Data truncation Issue while exporting an XML from SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795081#M254992</link>
    <description>&lt;P&gt;Hello&lt;BR /&gt;Can you share sample data and the code you are using?&lt;BR /&gt;Make sure the data includes good and bad fields and should be as a data step.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Feb 2022 23:12:00 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2022-02-08T23:12:00Z</dc:date>
    <item>
      <title>Data truncation Issue while exporting an XML from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795068#M254984</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS I have a dataset and I need to export that an XML file in UTF-8 encoding. In a particular field, there is a long string with special characters which is getting truncated while exporting to XML. There are other values which has more characters are exported without any issue. But the particular field with issue has more special characters. Requesting your help to get it resolved&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 20:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795068#M254984</guid>
      <dc:creator>sathasivam</dc:creator>
      <dc:date>2022-02-08T20:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Data truncation Issue while exporting an XML from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795081#M254992</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;Can you share sample data and the code you are using?&lt;BR /&gt;Make sure the data includes good and bad fields and should be as a data step.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 23:12:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795081#M254992</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-02-08T23:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Data truncation Issue while exporting an XML from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795084#M254995</link>
      <description>Hello, Thanks for the response&lt;BR /&gt;&lt;BR /&gt;Value from Dataset:&lt;BR /&gt;8822: yhrtahdjdidodjdhsgs 'Gebeew: Harash 2 &amp;amp; 3'Met outgrguytf rocket 'Gebeew: Harash 8 &amp;amp; 9' ward tyehtdhctsf or luhuh edf oea doo Rankedd DOublueh OH abëpogf tyfjjfb.Ir ravel doubl ufhjfnbf kj uhtdgc poyhgdb or do siyufjdkhvnfbg khhff onto ereikendheid&lt;BR /&gt;&lt;BR /&gt;Value in XML:&lt;BR /&gt;&lt;BR /&gt;8822: yhrtahdjdidodjdhsgs 'Gebeew: Harash 2 &amp;amp;amp; 3'Met outgrguytf rocket 'Gebeew: Harash 8 &amp;amp;amp; 9' ward tyehtdhctsf or luhuh edf oea doo Rankedd DOublueh OH abëpogf tyfjjfb.Ir ravel doubl ufhjfnbf&lt;BR /&gt;&lt;BR /&gt;Truncated portion:&lt;BR /&gt;&lt;BR /&gt;kj uhtdgc poyhgdb or do siyufjdkhvnfbg khhff onto ereikendheid&lt;BR /&gt;&lt;BR /&gt;XML map used:&lt;BR /&gt;&lt;BR /&gt;%macro file_loop(Field_ID);&lt;BR /&gt;if &amp;amp;Field_ID. not in('.',' ') then Do;&lt;BR /&gt;if indexc(&amp;amp;Field_ID.,'&amp;amp;%&amp;lt;&amp;gt;') = 0 then do;&lt;BR /&gt;put '&amp;lt;question&amp;gt;';&lt;BR /&gt;put '&amp;lt;answer&amp;gt;' &amp;amp;Field_ID. +(-1) '&amp;lt;/answer&amp;gt;';&lt;BR /&gt;put '&amp;lt;/question&amp;gt;';&lt;BR /&gt;End;&lt;BR /&gt;else Do;&lt;BR /&gt;put '&amp;lt;question&amp;gt;';&lt;BR /&gt;Field_Special = HTMLENCODE(&amp;amp;Field_ID.);&lt;BR /&gt;put '&amp;lt;answer&amp;gt;' Field_Special +(-1) '&amp;lt;/answer&amp;gt;';&lt;BR /&gt;put '&amp;lt;/question&amp;gt;';&lt;BR /&gt;end;&lt;BR /&gt;End;&lt;BR /&gt;else Do;&lt;BR /&gt;put '&amp;lt;question&amp;gt;';&lt;BR /&gt;put '&amp;lt;answer/&amp;gt;';&lt;BR /&gt;put '&amp;lt;/question&amp;gt;';&lt;BR /&gt;end;&lt;BR /&gt;%mend file_loop;&lt;BR /&gt;&lt;BR /&gt;Another query is, in data set there is an "&amp;amp;" symbol which is printed as "&amp;amp;amp;" in XML, please help with the same, Thanks in advance</description>
      <pubDate>Tue, 08 Feb 2022 23:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795084#M254995</guid>
      <dc:creator>sathasivam</dc:creator>
      <dc:date>2022-02-08T23:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Data truncation Issue while exporting an XML from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795101#M255000</link>
      <description>&lt;P&gt;You seem to be showing a macro that generates PART of a data step.&lt;/P&gt;
&lt;P&gt;To know why values might be truncated you need to see the full data step that is being run.&amp;nbsp; And the definition of any input data it is reading.&lt;/P&gt;
&lt;P&gt;For example your macro is generating this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Field_Special = HTMLENCODE(&amp;amp;Field_ID.);
put '&amp;lt;answer&amp;gt;' Field_Special +(-1) '&amp;lt;/answer&amp;gt;';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What is the length defined for the variable FIELD_SPECIAL?&lt;/P&gt;
&lt;P&gt;What is the value of the macro variable FIELD_ID?&amp;nbsp; If it is the NAME of a variable then what is the length defined for that variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be extra careful you might try defining FIELD_SPECIAL to be longer.&amp;nbsp; The maximum length for a character variable is 32767 bytes.&amp;nbsp; So try adding this line to the top of the data step where you are going to run the code generated by calling that macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length FIELD_SPECIAL $32767 ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Feb 2022 03:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795101#M255000</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-09T03:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Data truncation Issue while exporting an XML from SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795161#M255023</link>
      <description>Hi Tom,&lt;BR /&gt;&lt;BR /&gt;Declared length FIELD_SPECIAL $32767 ; in datastep and it is working as expected&lt;BR /&gt;&lt;BR /&gt;Thank you</description>
      <pubDate>Wed, 09 Feb 2022 11:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-truncation-Issue-while-exporting-an-XML-from-SAS/m-p/795161#M255023</guid>
      <dc:creator>sathasivam</dc:creator>
      <dc:date>2022-02-09T11:56:37Z</dc:date>
    </item>
  </channel>
</rss>

