17.02.2013 Views

achadoop

achadoop

achadoop

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

20 Chapter 1 • SAS/ACCESS Interface to Hadoop<br />

2011-10-17<br />

2009-07-30 12:58:59<br />

11:30:01<br />

data; set hdp.testHiveDate(dbsastype=(dt='date')); put dt; run;<br />

17OCT2011<br />

30JUL2009<br />

.<br />

data; set hdp.testHiveDate(dbsastype=(dt='datetime')); put dt; run;<br />

17OCT2011:00:00:00<br />

30JUL2009:12:58:59<br />

.<br />

data; set hdp.testHiveDate(dbsastype=(dt='time')); put dt; run;<br />

.<br />

12:58:59<br />

11:30:01<br />

This code uses SAS SQL to access a Hadoop table.<br />

proc sql;<br />

create table work.a as select * from hdp.newtab;<br />

quit;<br />

SAS data is then loaded into Hadoop.<br />

data hdp.newtab2;<br />

set work.a;<br />

run;<br />

Use implicit pass-through SQL to extract only 10 rows from the newtab table and load<br />

the work SAS data set with the results.<br />

proc sql;<br />

connect to hadoop (server=hxpduped);<br />

create table work.a as<br />

select * from connection to hadoop (select * from newtab limit 10);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!