* RAD, 1.29.04; * http://www.devenezia.com * * reverse the order of the bits of an integer value *; data _null_; x_chr = '100100100100'; x_val = input (x_chr,binary32.); x_rev = input (reverse (put (x_val,binary32.)), binary32.); x_inv = BNOT (x_val); x_neg = -x_val; put x_val= binary32. // x_rev= binary32. ' input(reverse(put reverses the bit sequence' / x_inv= binary32. ' BNOT() inverts bits' / x_neg= binary32. ' negative is 2s compliment' ; put / "DATA Step has functions BLSHIFT and BRSHIFT, but can not shift with carry :("; run;