Sas 列出零频率的变量-Proc Freq或Proc表格

Sas 列出零频率的变量-Proc Freq或Proc表格,sas,Sas,我正在选择一组zipcodes,通过一个二乘二的表格按年龄组将频率计数制成表格。我想列出频率计数为零的zipcodes,以便在最后的表格中显示所选zipcodes的整个组以及年龄组的整个可能组合(有5个年龄组) 下面是我尝试使用Proc Freq的代码。这仍然没有列出所有可能的组合 proc freq data = join; where group_1 = 1 and ZIP in ('20814' '20815' '20816' '20817' '20832' '20850' '20851

我正在选择一组zipcodes,通过一个二乘二的表格按年龄组将频率计数制成表格。我想列出频率计数为零的zipcodes,以便在最后的表格中显示所选zipcodes的整个组以及年龄组的整个可能组合(有5个年龄组)

下面是我尝试使用Proc Freq的代码。这仍然没有列出所有可能的组合

proc freq data = join;
where group_1 = 1 and ZIP in ('20814' '20815' '20816' '20817' '20832' 
'20850' '20851' '20852' '20853' '20866') and Race_n = 'NH-Black';
tables ZIP*agegrp / nocol norow nopercent sparse list;
title "Disease Mortality Counts 2016 By Race";
run;

过程列表

您需要一个
classdata
表,列出类组合的所有可能值

例如:

data all_ages;
  do age = 18 to 65;
    output;
  end;
run;

data patients;
  do patid = 1 to 10000;
    do until (age not in (19, 23, 29, 31, 37, 41, 43,  47, 53, 59));
      age = 18 + int((65-17) *ranuni(123));
    end;
    output;
  end;
run;

proc format;
  value misszero .=0 other=[best12.];

proc tabulate data=patients classdata=all_ages;
  class age ;
  table age, n*f=misszero.;
run;

程序频率

使用classdata修改数据,并为classdata项指定一个零权重。在
weight
语句中允许零作为权重

data patients_v;
  set
    patients
    all_ages (in=zero)
  ;
  unity = 1 - zero;
run;

proc freq data=patients_v;
  table age;
  weight unity / zeros ;
run;

它列出了什么,没有列出什么?其中一个年龄组没有任何计数,因此proc freq根本没有列出该年龄组。而该年龄组在数据中的某个位置?如果它不在数据中,那么您需要使用CLASSDATA或preload-fmt方法。您能提供发生这种情况的采样数据吗?