Primary key in SAS dataset #498
-
Is it possible to define a primary key for a SAS dataset? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey, so SAS uses indexes, which are separate files that which are associated to the SAS Data Set. These can be created a number of ways, and they can also have various constraints, which can match what a primary key is. Indexes can be created a number of ways, either when a data set is created or after the fact. This can be done using various syntaxes, via data step or procs, like proc datasets and and proc sql (proc sql uses syntax like 'primary key'). There's a good set of info here in the sections labeled SASPy does provide ways to interact with some of what you may need. You can create a simple index using the I'm not completely sure of your use case, but if you define a primary key on a SAS data set, then when you append to it, SAS will enforce that constraint and you can just append rows to it with no need to read it into pandas first. Tom |
Beta Was this translation helpful? Give feedback.
Hey, so SAS uses indexes, which are separate files that which are associated to the SAS Data Set. These can be created a number of ways, and they can also have various constraints, which can match what a primary key is. Indexes can be created a number of ways, either when a data set is created or after the fact. This can be done using various syntaxes, via data step or procs, like proc datasets and and proc sql (proc sql uses syntax like 'primary key'). There's a good set of info here in the sections labeled
Indexes
andIntegrity Constraints
. SAS decides to use the indexes based upon how the data set is being processed. For instance, when WHERE clauses are used, or By Group processing is …