Using SAS, is it possible to get a frequency table where no data exist? -


this follow-up previous post on so.

i trying produce frequency table of demographics, including race, sex, , ethnicity. 1 table crosstab of race sex hispanic participants in study. however, there no hispanic participants far. so, table zeroes, still have report it.

this can done in r, far, have found no solution sas. example data below.


data race; input race  eth  sex   ; cards; 1   2   1 1   2   1 1   2   2 2   2   1 2   2   2 2   2   1 3   2   2 3   2   2 3   2   1 4   2   2 4   2   1 4   2   2 run;     data class;     race = 1,2,3,4,5,6,7;         eth = 1,2,3;             sex = 1,2;                 output;             end;         end;     end; run;    proc format;      value   frace   1 = "american indian / ak native"                         2 = "asian"                         3 = "black or african american"                         4 = "native hawiian or other pi"                         5 = "white"                         6 = "more 1 race"                         7 = "unknown or not reported" ;      value   feth            1 = "hispanic or latino"                             2 = "not hispanic or latino"                             3 = "unknown or not reported" ;      value   fsex        1 = "male"                         2 = "female"  ;  run;       *****  ethnicity sex  ;  proc tabulate data = race missing classdata=class ; class  race eth sex ; table eth, sex / misstext = '0' printmiss; format race frace. eth feth.  sex fsex. ; run;    *****  race sex  ;  proc tabulate data = race missing classdata=class ; class  race eth sex ; table race, sex / misstext = '0' printmiss; format race frace. eth feth.  sex fsex. ; run;    *****  race sex, hispanic  ; *****  log indicates logical page missing values has been deleted ; *****  sas, you're big help...  ;  proc tabulate data = race missing classdata=class ; eth = 1 ; class  race eth sex ; table race, sex / misstext = '0' printmiss; format race frace. eth feth.  sex fsex. ; run; 

i understand code can't work because i'm selecting eth equal 1 (there no cases satisfying condition...). specifying command run by eth doesn't work either.

any guidance appreciated...

i think easiest way create row in data has missing value. @ following paper suggestions how on larger scale:

http://www.nesug.org/proceedings/nesug11/pf/pf02.pdf

proc freq has sparse option, gives possible combinations of variables in table (including missing ones), doesn't gives need.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -