BookmarkSubscribeRSS Feed
rkumar23
Calcite | Level 5


Could somebody please suggest me an idea....

We have Raw data which is being read and an variable MCL is getting created using $CHAR8. format and then when I print it with Format $HEX16. get below values...

MCL

----------

0008001E0001000F

00080015000000A3

0008001E0001000F

00080015000000A3

0008001E0001000F

00080015000000A3

0008001E0001000F

00080015000000A3

0008001E0001000F

Now each byte need to be converted in the format    AA.BB.CC.DDDD format so for example if we take 0008 it will be 8 ,001E=30,0001=1,000F=15 

so equivalent of hex value 0008001E0001000F should be 8.30.1.15   ....Could somebody suggest me how we do that?

1 REPLY 1
Kurt_Bremser
Super User

Quick brute force attack:

data _null_;

length result $20;

x = input('0008001E0001000F',$hex16.);

xh = put(x,$hex16.);

x1 = input(substr(xh,1,4),hex4.);

x2 = input(substr(xh,5,4),hex4.);

x3 = input(substr(xh,9,4),hex4.);

x4 = input(substr(xh,13,4),hex4.);

result = compress(put(x1,best5.)!!'.'!!put(x2,best5.)!!'.'!!put(x3,best5.)!!'.'!!put(x4,best5.));

put result=;

run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 4512 views
  • 1 like
  • 2 in conversation