PG_IDENTITY_COLS= Data Set Option

Specifies that sequencing is being applied to one or more columns.

Valid in: DATA and PROC steps (when accessing DBMS data using SAS/ACCESS software)
Category: Data Set Control
Default: none
Restrictions: This option is not supported when INSERT_SQL=NO or with any operation that modifies the cursor position in a table.
When BULKLOAD=YES, the sequence name must be associated with a Sequence object that was created previously by using the APPEND procedure.
Data source: PostgreSQL, Yellowbrick
Notes: Support for this data set option was added in SAS Viya 3.5.
Support for Yellowbrick was added in SAS 9.4M7.
See: DBTYPE= data set option

Syntax

PG_IDENTITY_COLS=(column-name="nextval('sequence-name')"
< ... column-nameN="nextval('sequence-nameN')">)

Required Arguments

column-name

specifies the column name to use for sequential values.

sequence-name

specifies the name of the sequence to use in the associated column.

Details

If you create a data set using this option and you do not specify a data type for the associated column, then SAS/ACCESS creates a BIGINT column that cannot take NULL values. You can create a column with a different data type by using the DBTYPE= data set option when you create the data set.

Example

This example assigns the sequence object Myseq to the Idnum column in table User.Mydata that is being created in the PostgreSQL database. The source for the Mydata table is the SAS data set Work.New.

data work.new;
   idnum=.; myname='test1'; output;
   idnum=.; myname='test2'; output;
   idnum=.; myname='test3'; output;
   idnum=.; myname='test4'; output;
   idnum=.; myname='test5'; output;
run;

proc sql;
   create table user.mydata(idnum int, myname char(10));
   insert into user. mydata(bulkload=no 
                            pg_identity_cols=(idnum="nextval('myseq')")
                           );
   select * from work.new;
   select * from user.mydata;
quit;
Last updated: February 3, 2026