<?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 convert double to int32 and varchar to varbinary in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888143#M350911</link>
    <description>&lt;P&gt;Perhaps someone with PROC DS2 experience can help with generating those non-SAS data types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But from your picture of the description of the source table it looks like you can just read the INT32 value into a normal numeric variable since it says it has a maximum of 12 significant digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what a VARBINARY field is but if you read the field using $CHAR informat it should allow you to store any bytes that it might contain.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if the actual content of the field contained bytes with a value of '2C'x then trying to store the values into a CSV file is probably not a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you should have written out a fixed length file with 4 bytes for the 32 bit integer and 164 bytes for the VARBINARY field.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Aug 2023 15:16:01 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-08-07T15:16:01Z</dc:date>
    <item>
      <title>How to convert double to int32 and varchar to varbinary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888138#M350909</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a CSV file with two fields: an INT32 and a VARBINARY. This file was exported from a SAS Viya 3.5 CAS Table using Data Explorer. I imported this CSV into another SAS environment within CAS, and the resulting table has two fields: a varchar and a double. I need to convert the data types to varbinary and int32. I tried using a data step to perform the conversion, but it appears that data steps and procs are not compatible with INT32 and VARBINARY fields (according to this SAS document: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/pgmdiff/n0b6wc0bp6tt31n1l98k9g2l2l9b.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/pgmdiff/n0b6wc0bp6tt31n1l98k9g2l2l9b.htm&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone knows How can I perform these types of conversions?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PS: Original Table exported to CSV:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alisio_meneses_0-1691418103018.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86492iC77D7DDD4F14FD7A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alisio_meneses_0-1691418103018.png" alt="alisio_meneses_0-1691418103018.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Table resulted from importing the CSV file:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alisio_meneses_1-1691418363781.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86493i4CBAEE05E07D4479/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alisio_meneses_1-1691418363781.png" alt="alisio_meneses_1-1691418363781.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 14:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888138#M350909</guid>
      <dc:creator>alisio_meneses</dc:creator>
      <dc:date>2023-08-07T14:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert double to int32 and varchar to varbinary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888143#M350911</link>
      <description>&lt;P&gt;Perhaps someone with PROC DS2 experience can help with generating those non-SAS data types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But from your picture of the description of the source table it looks like you can just read the INT32 value into a normal numeric variable since it says it has a maximum of 12 significant digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what a VARBINARY field is but if you read the field using $CHAR informat it should allow you to store any bytes that it might contain.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if the actual content of the field contained bytes with a value of '2C'x then trying to store the values into a CSV file is probably not a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you should have written out a fixed length file with 4 bytes for the 32 bit integer and 164 bytes for the VARBINARY field.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 15:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888143#M350911</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-07T15:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert double to int32 and varchar to varbinary</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888183#M350928</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding the VARBINARY field: the original table, the one exported to CSV, was generated using the 'save' Action from the 'Tables' Action Set. It contains attributes from another table and includes a field with this data type (along with another field of type INT32).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue I'm facing is that I'm attempting to transfer data between different SAS Viya environments while trying to maintain the same table attributes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc cas;
   ldaTopic.ldaScore /
      docDistOut={caslib='acaslib', name="documents",
                  replace=TRUE
                 }
      docId="documents_id"
      modelTable={caslib="Public", name="lda_topics"}
      table={caslib="acaslib", name="input_prepared"}
      text={{name="text_prepared"}};
   run;
quit;   &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 17:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-double-to-int32-and-varchar-to-varbinary/m-p/888183#M350928</guid>
      <dc:creator>alisio_meneses</dc:creator>
      <dc:date>2023-08-07T17:24:15Z</dc:date>
    </item>
  </channel>
</rss>

