<?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 Set a bit in SAS for string more than 32bits in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51170#M10710</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;I have a string of 0,1s upto 64bits. I am trying to set 0 bit to 1 conditionally. say for a 56bit long string, i want to set 38th bit to 1 if it was 0. i tried BLSHIFT and BOR functions. if the string length is less than 32 bits, it is fine. but it is stop working when the length of string exceeds 32 bits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;For now, I have to use multile functions to convert the bit string to a number , then add some number, then convert it back to binary representation. for example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let len=56;&lt;/P&gt;&lt;P&gt;%let Node=1;&lt;/P&gt;&lt;P&gt;%let Marked=%sysfunc(repeat(0,54))1;&lt;/P&gt;&lt;P&gt;%let marked=%sysfunc(putN(%sysevalf(2**%eval(&amp;amp;len.-&amp;amp;Node.)+%sysfunc(inputN(&amp;amp;Marked,binary&amp;amp;len.))),binary&amp;amp;len.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;gt;&amp;amp;marked&amp;lt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;if BLSHIT and BOR can work with bits string more than 32. the life will be much easier.&amp;nbsp; I posted same post on SAS-L. it looks like lots fof folks from SAS-L now are hanging out here. Hope i can get some responses quickly. sorry for reposting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;does anyone know If there are any functions can do more than 32bits manipulations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 31 Mar 2012 05:16:13 GMT</pubDate>
    <dc:creator>AUTigers</dc:creator>
    <dc:date>2012-03-31T05:16:13Z</dc:date>
    <item>
      <title>Set a bit in SAS for string more than 32bits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51170#M10710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;I have a string of 0,1s upto 64bits. I am trying to set 0 bit to 1 conditionally. say for a 56bit long string, i want to set 38th bit to 1 if it was 0. i tried BLSHIFT and BOR functions. if the string length is less than 32 bits, it is fine. but it is stop working when the length of string exceeds 32 bits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;For now, I have to use multile functions to convert the bit string to a number , then add some number, then convert it back to binary representation. for example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let len=56;&lt;/P&gt;&lt;P&gt;%let Node=1;&lt;/P&gt;&lt;P&gt;%let Marked=%sysfunc(repeat(0,54))1;&lt;/P&gt;&lt;P&gt;%let marked=%sysfunc(putN(%sysevalf(2**%eval(&amp;amp;len.-&amp;amp;Node.)+%sysfunc(inputN(&amp;amp;Marked,binary&amp;amp;len.))),binary&amp;amp;len.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;gt;&amp;amp;marked&amp;lt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;if BLSHIT and BOR can work with bits string more than 32. the life will be much easier.&amp;nbsp; I posted same post on SAS-L. it looks like lots fof folks from SAS-L now are hanging out here. Hope i can get some responses quickly. sorry for reposting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;does anyone know If there are any functions can do more than 32bits manipulations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Mar 2012 05:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51170#M10710</guid>
      <dc:creator>AUTigers</dc:creator>
      <dc:date>2012-03-31T05:16:13Z</dc:date>
    </item>
    <item>
      <title>Set a bit in SAS for string more than 32bits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51171#M10711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yu,&amp;nbsp; Other than peek and poke, I don't know of any other bitwise functions that have been upgraded to cover more than 32 bit manipulations.&amp;nbsp; Paul Dorfman posts both here, and over on SAS-L, and you may have to wait for his possible response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Mar 2012 15:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51171#M10711</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-03-31T15:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set a bit in SAS for string more than 32bits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51172#M10712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The question does not make any sense to me.&amp;nbsp; Perhaps if you explained WHY.&lt;/P&gt;&lt;P&gt;There is no conditional in your question.&lt;/P&gt;&lt;P&gt;Here is how to set the 38th digit of a character sting of 1s and 0s to a 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;42&amp;nbsp;&amp;nbsp; %let marked=%sysfunc(repeat(0,54))1;&lt;/P&gt;&lt;P&gt;43&amp;nbsp;&amp;nbsp; %let new=%substr(&amp;amp;marked,1,37)1%substr(&amp;amp;marked,39);&lt;/P&gt;&lt;P&gt;44&amp;nbsp;&amp;nbsp; %put &amp;amp;marked;&lt;/P&gt;&lt;P&gt;00000000000000000000000000000000000000000000000000000001&lt;/P&gt;&lt;P&gt;45&amp;nbsp;&amp;nbsp; %put &amp;amp;new;&lt;/P&gt;&lt;P&gt;00000000000000000000000000000000000001000000000000000001&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Mar 2012 15:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Set-a-bit-in-SAS-for-string-more-than-32bits/m-p/51172#M10712</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-31T15:38:33Z</dc:date>
    </item>
  </channel>
</rss>

