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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 4039 views
  • 1 like
  • 2 in conversation