While I can see a motivation for including the primary key as an attribute
or a property of a dataset, I can understand why one might classify the key
as a constraint instead of an attribute or a property of a dataset. One or
more keys either act as a primary key or they don't. In the absence of an
explicit constraint, updating or inserting data or deleting data from the
dataset may leave the key indistinct (or make it distinct). In either case,
the attribute or property would have to change with the change in data.
Since a constraint enforces primary key integrity,
it seems more appropriate to me to include the primary key metadata as a
feature of a constraint.
For example, we can use the DESCRIBE statement in SQL to determine whether a
table has a primary key in effect:
create table work.tblObject
constraint pKey primary key(ID,seq)
describe table work.tblObject
So far as I can tell, SAS does not provide a way to assign a list of the
primary key variables in a macrovariable. Something akin to the
dictionary.indexes table could easily store those metadata and make them
available to the programmer. I'd vote for that!
From: Fehd, Ronald J. (PHPPO) [mailto:rjf2@CDC.GOV]
Sent: Monday, June 09, 2003 10:19 AM
Subject: SUGI: metadata or metastructure
yeah, I just made up this word over the weekend
while trying to figure out where to put it in my Style Sheet chapter.
related to Futures Forum
and other discussions w/developers or Little Birdies
about My Wish List
I had asked for another column of data set information.
if you look at all the data structure that one can declare
in the data step with the attribute statement
-- length, format, informat, label etc --
there is a similar set of information
about the data -structure- that is missing.
while I could add, in the program,
some notes to the variable definitions
with macro comments:
attrib ID length = 4 %*primary key, integer;
there is no place to -record- such metastructure
so that it can reside with the data set.
a Glaring Oversight, imnsho.
a quick glance at a contents output shows
data set label
sorted, and sort order,
which are added or returned by proc SORT
-- btw: transferring a data set to another operating system
negates that information --
what I consider metastructure
could probably be handled in a field of maybe 4096 bytes
in which I would cram such goodness or information
into some xml
<BoyceCoddNormalForm=1> <PrimaryKey=ID> <ForeignKey=Department>
<TitleForFehdSUGI28ppt=Definitely a Nice Idea>
see Boyce-Codd Normal Form BCNF
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
remember perspective: the metastructure
is not always where it needs to occur! -- RJF2
RTFM: I'm an engineer, I don't get paid to know,
I get paid to know where to look it up.
RTFM: Read The Finite metastructure
do not fold, spindle, or mutilate -- IBM punch card
... the metastructure