With table as is, this is fairly close:
proc tabulate data=employeesl;
class station gender race stationID;
table (station*stationID all), race=''*gender=''*N='' / misstext='0';
run;
To have the gender/race headers all in one column and expanded, you can use formats and/or combine them into a single variable and then use the single variable instead of the race*gender in proc tabulate.
Is the table a SAS dataset or for a report, ie PDF?
data employeesl;
input employee $ station $ gender $ race $ StationID;
datalines;
Smith west F B 124
Turner east M W 123
Porter north M W 125
William west F W 124
Lee south F B 126
Maine south M B 126
;
run;
*formats to control display;
proc format;
value $ race_fmt 'B'='Black' 'W'='White' other='Other';
value $ gender_fmt 'F'='Female' 'M'='Male' other='Other';
run;
*generic tabulate;
proc tabulate data=employeesl;
class station gender race stationID;
table (station*stationID all), race=''*gender=''*N='' / misstext='0';
format gender $gender_fmt. race $race_fmt.;
run;
*combining categorical variables of race/gender;
data employeesl;
set employeesl;
category=catx(" ", put(race, $race_fmt.), put(gender, $gender_fmt.));
run;
*tabulate with category combined;
proc tabulate data=employeesl out=long;
class station stationID category;
table (station*stationID all), category=''*N='' / misstext='0';
run;
proc sort data=long;
by descending station stationId;
run;
*output in dataset;
proc transpose data=long out=wide (drop=_:);
by descending station stationid;
id category;
var N;
run;
*fill in missing and add ALL label;
data wide;
set wide;
array _vars _numeric_;
do over _vars;
if _vars=. then
_vars=0;
end;
if missing(station) then
do;
station='All';
call missing(stationID);
end;
run;
*display results;
proc print data=wide noobs;
run;