BookmarkSubscribeRSS Feed
MartinJ
Calcite | Level 5

How can we easily convert hex values in SAS ESP?

Eg. In a Rabbit queue we have a message containing "B6" witch needs to be interpreted as "182". 

We are using ESP5.1 and 5.2

Thanks.

2 REPLIES 2
AndyT_SAS
SAS Employee

There isn't a built in function for this in the functional window or compute window.  You could use a python window or write a C++ function to do this.

MartinJ
Calcite | Level 5

Thanks AndyT. I have created a mas for this and that works fine!

 

<mas-module module="New_Module_1" language="python" func-names="hextodex">
<code><![CDATA[def hextodex(sensorID):
"Output: sensorID_N"
sensorID_N = int(sensorID, base=16)
return sensorID_N]]></code>
</mas-module>