|Date: ||Wed, 14 Oct 2009 16:17:09 -0700|
|Reply-To: ||paulsparrow <paulsparrow@TELUS.NET>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||paulsparrow <paulsparrow@TELUS.NET>|
|Subject: ||Re: Hexidecimal Conversion|
|Content-Type: ||text/plain; charset=ISO-8859-1|
On Oct 14, 3:46 pm, Mterje...@RUSSELL.COM ("Terjeson, Mark") wrote:
> Hi Paul,
> You can solve this two ways:
> On the SQLSVR side:
> just use cast(wasBinary as integer)
> and cast it to integer before going to SAS.
> select cast(wasBinary as integer) as nowInteger
> from (--test data
> select cast(27 as binary) as wasBinary
> ) as a
> On the SAS side:
> just use input(fromsqlsvr,hex16.)
> in datastep code or SQL code. e.g.
> data _null_;
> fromsqlsvr = '0000000000001B';
> myinteger = input(fromsqlsvr,hex16.);
> put _all_;
> Hope this is helpful.
> Mark Terjeson
> Investment Business Intelligence
> Investment Management & Research
> Russell Investments
> Global Leaders in Multi-Manager Investing
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of
> Sent: Wednesday, October 14, 2009 1:29 PM
> To: SA...@LISTSERV.UGA.EDU
> Subject: Re: Hexidecimal Conversion
> This is my issue. IN SQL SERVER the data field is a BINARY format.
> When I look at it in SAS through ODBC it is a $HEX16. (in otherwords
> a charactor).
> CAST(field as INT) in SQL gives me an integer of the field.
> I have tried PUT(field,$HEX16.) and it returns exactly what I pullled
> already. Example 0000000000001B What I need is the integer equvilant
> of say 123 (or what ever it equals)
> Sorry but I'm not a brain at this stuff.- Hide quoted text -
> - Show quoted text -
Yes I finally looked back at some old code and I can CAST it in SQL
before bringing it back. Thanks.
Connect to odbc("DSN=nscupink;");
Create table bird.conv01c as
from connection to odbc (
CAST(RM.CONTACT_ID as INT) as member_id