How to capture RC from SAS Program into K-shell

I am running a SAS program within K-shell. This SAS program gives me return code of 3000. However, when I check return code in my K-shell, it displays RC=2.
Can someone tell me how to capture RC from SAS to K-shell?

Thanks.

Pramodini

Are you sure its not an error code? What version of SAS?

Yes, it is not the the return code that I expect to see in my shell. I expect to see 3000 which is a return code from SAS but shell displays return code of 2. I have SAS 9.1.3 Service pack 4.

---------- Post updated at 03:41 PM ---------- Previous update was at 11:06 AM ----------

I got it.

SAS generates the return code of 3000 (I am using syserr macro variable which contains the rc for the step, but the same value is stored in the syscc macro variable which contains the rc for the job). However, at exit time SAS translates the syscc error to something that is meaningful within the operating system.

From what I can find:

� SYSERR Code of 3000 in SAS 9.1 means "an error occurred" (this reference is for SAS 9.1 Macro Language Dictionary : SYSERR Automatic Macro Variable)
� Unix Return Code of 2 from a SAS process means "SAS issued error(s)" (this reference is for SAS 9.1 Macro Facility under UNIX : Automatic Macro Variables in UNIX Environments)