03-31-2012 01:16 AM
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.
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,
if BLSHIT and BOR can work with bits string more than 32. the life will be much easier. 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.
does anyone know If there are any functions can do more than 32bits manipulations?
03-31-2012 11:01 AM
Yu, 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. Paul Dorfman posts both here, and over on SAS-L, and you may have to wait for his possible response.
03-31-2012 11:38 AM
The question does not make any sense to me. Perhaps if you explained WHY.
There is no conditional in your question.
Here is how to set the 38th digit of a character sting of 1s and 0s to a 1.
42 %let marked=%sysfunc(repeat(0,54))1;
43 %let new=%substr(&marked,1,37)1%substr(&marked,39);
44 %put &marked;
45 %put &new;