DATA Step, Macro, Functions and more

is &sysjobid unique?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

is &sysjobid unique?

Hi!

We plan to use the &sysjobid macro variable as an id for our historical tables to indicate uniqueness of data batches. Is it possible to recur?

Thanks for the help!


Accepted Solutions
Solution
‎08-03-2011 08:59 AM
Valued Guide
Posts: 2,177

is &sysjobid unique?

so, guess the correct answer is:

no

View solution in original post


All Replies
Occasional Contributor
Posts: 7

is &sysjobid unique?

by the way, we have a Unix envt. :smileylaugh:

Valued Guide
Posts: 2,177

is &sysjobid unique?

in SAS on unix the sysjobID is filled with the PID (the process ID) value. It will _very_ probably be unique. I cannot imagine how it would not be unique.

Super User
Super User
Posts: 7,039

is &sysjobid unique?

I am not sure the &SYSJOBID will be unique over time so that you could use it as a historical reference. I know that on Unix it will restart the process id numbers when the server reboots.  They might even cycle around if you run the server long enough.  Also what if your jobs are distributed across servers.

Super User
Posts: 5,426

is &sysjobid unique?

Agree with Tom, the pid is not unique over time.

So you probably have to create your own id. Or, why not use a timestamp, that should be unique in most applications?

/Linus

Data never sleeps
Contributor
Posts: 28

is &sysjobid unique?

Hi,

No, pid is certainly not unique Smiley Wink otherwhise after a while your server can't run any process because the pid is full...

you could use a reference table who logs your id and each time you want to create a new one select max+1 and the jobname.

other possiblity is jobname+datetime.

date is not enough, you could run twice the same day your process. never say never...

Valued Guide
Posts: 2,177

is &sysjobid unique?

as we use more parallel processing like grid, we will increase the number of ways similar tasks might start at the same time.

However, a consistent hash of server address and timestamp and process id + perhaps a 6-digit random number, might generate a unique id

Solution
‎08-03-2011 08:59 AM
Valued Guide
Posts: 2,177

is &sysjobid unique?

so, guess the correct answer is:

no

Occasional Contributor
Posts: 7

is &sysjobid unique?

I see. Thanks for the help guys, as well as for the tips. Smiley Happy

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 485 views
  • 3 likes
  • 5 in conversation