Date: Thu, 20 Apr 2006 18:50:13 -0500
Reply-To: Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Subject: Re: Convert EBCDIC rep of binary to binary
Content-Type: text/plain; charset=US-ASCII
John:
See if this is what you are looking for.
2302 data _null_;
2303 length ca01EB $ 28 hexRep $ 14;
2304 ca01EB='F082F883F783F8F0F6F6F0F8F0F3';
2305 put ca01EB=;
2306 hexRep=" ";
2307 do i=1 to length(ca01EB) by 2;
2308 if substr(ca01EB,i,1)='F' then hexRep=compress(hexRep) ||
substr(ca01EB,i+1,1);
2309 else hexRep=compress(hexRep) ||
byte(rank('A')-1+input(substr(ca01EB,i+1,1),1.));
2310 end;
2311 put hexRep=;
2312 binaryRep=put(input(hexRep,hex14.),binary56.);
2313 put binaryRep=;
2314 run;
ca01EB=F082F883F783F8F0F6F6F0F8F0F3
hexRep=0B8C7C80660803
binaryRep=00001011100011000111110010000000011001100000100000000011
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
J S Huang
1-515-557-3987
fax 1-515-557-2422
>>> John Mattson <John_Mattson@EA.EPSON.COM> 04/20/06 3:49 PM >>>
Trying to work with hex on zOS. I have a 14 byte field, which
is
the ascii representation of a binary number. 0b8c7c80660803.
----------------------------
ca01EB :0b8c7c80660803
88FFCC44444447F8F8F8FFFFFFFF
3101520000000A02837380660803
But where I need to get to is the actual binary value in a SAS
Numeric value.
------------------------------------------
ca01BI :.......
88FFCC 0878600
310152 bcc0683
I HAVE TRIED...
put(ca01EB,PIB07.); Doesn't work because ca01EB is a char
variable
ERROR 48-59: The format $PIB was not found or could not be loaded.
CA01EBN = INPUT(CA01EB,07.) ; I get
NOTE: Invalid argument to function INPUT at line
And a whole bunch of other things. Can anyone help?
I did find one work "way way way" around...
DATA WORK.TEMP ;
* str='0B8C7C80660803'X;
str='F082F883F783F8F0F6F6F0F8F0F3'x;
put 'str :' str hex28. ;
CALL SYMPUT('x',str);
run;
DATA WORK.TEMP ;
put 'x :' "&x";
y = &x.x;
put 'y :' y hex14. ;
run;