Hello everyone,
I have a data set has a hexadecimal variable,I want to convert it into character,please advise.(for example 6B should convert to k)
for your reference,the following website list the ralationship of hex and character.
Thanks
Mike.
data have;
input hex $;
cards;
4D
4F
76
20
28
6B
;
run;
hi ...
data have;
input hex $;
cards;
4D
4F
76
20
28
6B
;
data want;
set have;
new = byte(input(hex,hex.));
run;
hex new
4D M
4F O
76 v
20
28 (
6B k
here is my ugly method:
please advise
I hope there is a function could be use directly.
Thanks
data table;
do ascii=0 to 255;
char=byte(ascii);
put ascii= char=;
hex=put(char,$HEX.);
output;
end;
run;
data have;
input hex $;
cards;
4D
4F
76
23
20
28
24
47
6B
52
;
run;
proc sql noprint;
create table want as
select a.*,b.char
from have as a
left join table as b
on a.hex=b.hex
;
quit;
hi ...
data have;
input hex $;
cards;
4D
4F
76
20
28
6B
;
data want;
set have;
new = byte(input(hex,hex.));
run;
hex new
4D M
4F O
76 v
20
28 (
6B k
Thanks a lot Mike
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.