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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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