BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9
I want to make a local copy of an oracle table. I need all the indexs, constraints, PK, etc..

When I do the following I just get the data without any of the constraints.

data tree_node ;
set ora.tree_node ;
run ;

What is the best way to get the exact table definition as it is within oracle ?

thank you
5 REPLIES 5
Doc_Duke
Rhodochrosite | Level 12
SAS does not support table constraints, so you can't extract it except as a text file.
jerry898969
Pyrite | Level 9
Doc,
Thank you so much for your response.

So when I try and create a data set based off of an oracle table or a different sas data set that have primary or foreign keys why doesn't those keys come along with the new data set?

Thank you
Doc_Duke
Rhodochrosite | Level 12
Jerry,

From the SAS SQL documentation, "The SQL research project at SAS has focused primarily on the expressive power of SQL as a query language. Consequently, some of the database features of SQL have not yet been implemented in PROC SQL."

To understand all the differences (there are lots), you will need to read all about SAS Datasets in the BASE documentation concepts area and the differences between SAS SQL and ANSI SQL.

Doc
jerry898969
Pyrite | Level 9
Doc,

Thank you I will look at the documentation.

I made the mistake of assuming since I was creating a data set based off of another data set that the PK and FK would carry along with it.

Thank You
bentleyj1
Quartz | Level 8

SAS does support integrity constraints but they do not come along with the data when you create a data set from an Oracle table.  They must be recreated using PROC DATASETS.  Here's a link to Mike Raithel's 2011 SGF paper.  It's a .pdf so just search on 'constraint'.  http://support.sas.com/resources/papers/proceedings11/274-2011.pdf

If the primary key and foreign key physically exist as fields in an Oracle table I don't know of any reason why they wouldn't be in the SAS data set, but there won't be anything other than the variable name to indicate that they are the PK and FK.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1660 views
  • 0 likes
  • 3 in conversation