+1  A: 

You may want something like this:

/* Create the month variable into a string YYYY/MM */
data analysts0;
    set <your data>;
    format month $7.;
    month=cats(year(date),'/',put(month(date),z2.));
run;
/* Sort so you can do the by processing required for counting */
proc sort data=analyst0 out=analyst1;
    /* You need to include the date in the sort so the most recent is last */
    by ticker month date;
run;
/* Count */
data count;
    retain n_fem n_male 0;
    set analyst1;
    by ticker month;
    if first.ticker of first.month then do;
        n_fem=0;
        n_male=0;
    end;
    else do;
       if gender=1 then n_fem+1;
       else if gender=0 then n_male+1;
       else put 'Huh?';
    end;
    /* this outputs only the values you need.*/
    if last.ticker or last.month then output;
run;

This should give you the general idea - I don't have access to SAS right now so I can't check the code. See the documentation for retain and by processing in the data step for more details.

Ville Koskinen
Ugh, this string is a little bit difficult for me.I tried:data analyst0; set final; format month $7. month=cats(year(recdats),'/',put(month(recdats),z2.));run;with recdats being of the type date9 "21jan2001" and "final" the data set.I get an error though: ERROR 85-322: Expecting a format name.ERROR 76-322: Syntax error, statement will be ignored.This is what my data looks like: http://i40.tinypic.com/2d2iwy.pngCheers though!
John
@John, it seems that I've missed some semicolons... I'll edit the answer.
Ville Koskinen
@John, I modified the code slightly. There is one missing semicolon in the code you provided in the comment, the format statement should be: format month $7.; Also, I think the cats function is only available on SAS 9, so you might want to replace it with trim(left())-calls if cats is not available to you.
Ville Koskinen