不是100%确定如果我明白你的问题是正确的,但我试图提供一个解决方案。
这可能是一个复杂的解决方案,我想有很多简单/简单的解决方案。我算每种疾病的freqs,它们合并到一个数据集,并用gplot吸引他们:
data x;
input HoHTAge HoGDAge AddDAge CelDAge;
datalines;
0 0 32 0
0 0 0 0
12 0 23 0
0 20 0 0
25 0 0 0
0 0 0 0
32 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 35
45 0 0 0
0 0 0 0
0 0 0 0
43 0 0 0
0 23 0 0
0 18 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 12 0 0
30 26 0 0
0 40 46 0
0 0 0 30
57 0 0 0
0 0 0 0
;
run;
proc freq data=x noprint ;
tables HoHTAge/out=a;
run;
proc freq data=x noprint ;
tables HoGDAge/out=b;
run;
proc freq data=x noprint ;
tables AddDAge/out=c;
run;
proc freq data=x noprint ;
tables CelDAge/out=d;
run;
data res (drop =percent count);
merge a (in=a rename=(HoHTAge=age)) b (in=b rename=(HoGDAge=age)) c (in=c rename=(AddDAge=age)) d(in=d rename=(CelDAge=age));
by age;
*if age=0 then count=0; /*if you want to exclude age 0*/
if a then HoHTAge=count; else HoHTAge=0;
if b then HoGDAge=count; else HoGDAge=0;
if c then AddDAge=count; else AddDAge=0;
if d then CelDAge=count; else CelDAge=0;
ruN;
/* Set the graphics environment */
goptions reset=all cback=white border htext=10pt htitle=12pt;
axis1 label=("age");
axis2 label=("Count");
symbol1 interpol=join color=R height=14pt font='Arial' ;
symbol2 interpol=join color=B height=14pt font='Arial';
symbol3 interpol=join color=O height=14pt font='Arial' ;
symbol4 interpol=join color=BL height=14pt font='Arial' ;
legend1 repeat=1 label=none frame;
proc gplot data=res;
plot (HoHTAge HoGDAge AddDAge CelDAge)*age/ overlay legend=legend1 haxis=axis1 vaxis=axis2;
run;
与样本数据,这将导致这个图,我想用真实的数据,这将更好看,因为现在我们有没有年龄,曾多次针对每种疾病:
作为简单的选择,你可以使用一个Proc频率点阵图,但你必须分隔的图表,只有点,据我了解,你想输出的像长期解决方案:
ods graphics on;
proc freq data=x ;
tables HoHTAge HoGDAge AddDAge CelDAge/plots=freqplot(type=dot ORIENT = VERTICAL);
run;
你有没有试过一些代码,它做了什么? – vielmetti
你是在一个变量或变量之内计算出的频率?所以如果32在列1中出现一次,在列3中出现一次,列1的频率是1 /(列1中的obs的数量)还是1 /(列1和3中的obs的数量)? – superfluous
对于freqplot,你可以在每个年龄的单个(点)情节中做到这一点,但据我了解,你希望所有年龄的频率在一个情节中作为一条线?包括0还是排除之前?一种方法是在Sperate步骤中构建图的数据,然后使用gplot。 – kl78