Date: Thu, 23 Feb 2012 11:11:32 -0500
Reply-To: Richard DeVenezia <rdevenezia@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Richard DeVenezia <rdevenezia@GMAIL.COM>
Subject: Is there a way to auto increment a column ?
Hello:
I am looking for a way to auto-increment an ID column. I don't want to
use a max(ID)+1 technique because rows might be deleted (such as the last
row) and ID values should not be re-used.
proc sql;
create table foo
( id num
, name char(50)
);
%* can id be autocomputed in some trigger way ?;
insert into foo(name) values
( 'Hey there');
%* id autocomputed in some forced way (non-atomic :()?;
insert into foo(id,name) values
( %NextId(foo), 'Hey there');
Thanks,
Richard A. DeVenezia
|