SAS & Primary Indexes
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


SAS & Primary Indexes Expand / Collapse
Author
Message
Posted 11/20/2007 5:20:13 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/20/2007 5:15:52 PM
Posts: 1, Visits: 1
Does SAS have the capability to explicitly specify a PI as a result of a select statement the way you can in TD?

If you can do this in TD:

CREATE SET TABLE db1.table1 AS
(SELECT name, ssn, address
FROM db2.customers)
WITH DATA
UNIQUE PRIMARY INDEX (ssn);

How do you do that in SAS - or can you?
Post #9805
Posted 12/3/2007 7:23:07 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/1/2008 2:49:57 PM
Posts: 6, Visits: 44
Basically, yes. If you are have a connection to a Teradata data source using the SAS LIBNAME mechanism, you can use the "dbcreate_table_opts" SAS data set option to specify any table create option. For example:

libname DB1 teradata user="&terauser" password="&terapass"
schema=DB1 DBCOMMIT=0;
libname DB2 some-other-data-source;
proc sql;
create table DB1.table1(dbcreate_table_opts='primary index(ssn)') as
SELECT name, ssn, address
FROM db2.customers;
quit;

I'd further recommend that you look up the "dbtype" SAS data set option if you choose to do this. That lets you explicitly define the column data types.

Of course, doing it this way only makes sense if your DB2 library is NOT in the same Teradata environment. In other words, if you're creating a Teradata table from a Teradata table, it's much better to use SAS's "pass-thru" facility, with which you can submit normal Teradata SQL:

proc sql;
connect to teradata (user="&terauser" password="&terapass" mode=teradata);
execute ( /* Your original code follows */
CREATE SET TABLE db1.table1 AS
(SELECT name, ssn, address
FROM db2.customers)
WITH DATA
UNIQUE PRIMARY INDEX (ssn)
) by teradata;
quit;
Post #9939
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 4:30pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 7 queries. Compression Disabled.