Numbers of records in SAS dataset

I'm declaring a variable within a Korn shell to represent the total number of records in a SAS dataset and could use a little help with the syntax. This is what I have thus far:

#!/usr/bin/ksh
RecCount = `sas -x "select count(*) from /users/abc/123/sas_dataset.sas7bdat"`

Don't put spaces around equal sign.

#!/usr/bin/ksh
RecCount=`sas -x "select count(*) from /users/abc/123/sas_dataset.sas7bdat"` 

or (more readable):

#!/usr/bin/ksh
RecCount=$(sas -x "select count(*) from /users/abc/123/sas_dataset.sas7bdat")

Jean-Pierre.

I am not familiar with -x as an option to SAS? Additionally, you will most likely have to write the process within a sas program and batch submit it in order to have SAS write an environment variable containing the information you seek.