j*********9 发帖数: 161 | 1 表达能力不太好,希望大家能看得懂。
n个variable代表n种疾病,1表示有病,“.”表示无此病。observation有3万多。
想最后得到一张n*n的表,能显示各种疾病的count以及任意两种疾病都有的count。我
用proc freq试了半天,能得到数据,就是不能弄成一张满意的表。
Help please!包子虽然不多,愿全部奉送!
|
D******n 发帖数: 2836 | 2 u might get it wrong.
it is not a orthogonal partition of the population.
think about this, ppl have diseases, A,B and C.
【在 j*********9 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 表达能力不太好,希望大家能看得懂。 : n个variable代表n种疾病,1表示有病,“.”表示无此病。observation有3万多。 : 想最后得到一张n*n的表,能显示各种疾病的count以及任意两种疾病都有的count。我 : 用proc freq试了半天,能得到数据,就是不能弄成一张满意的表。 : Help please!包子虽然不多,愿全部奉送! :
|
A*******s 发帖数: 3942 | 3 market basket/association rules mining
【在 j*********9 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 表达能力不太好,希望大家能看得懂。 : n个variable代表n种疾病,1表示有病,“.”表示无此病。observation有3万多。 : 想最后得到一张n*n的表,能显示各种疾病的count以及任意两种疾病都有的count。我 : 用proc freq试了半天,能得到数据,就是不能弄成一张满意的表。 : Help please!包子虽然不多,愿全部奉送! :
|
j*********9 发帖数: 161 | 4 I am sorry that i do not get it.
Do you mean people can not have so many diseases?
My project is based on real data. People are new born babies and disease are all kinds of birth defects. So, this should not be a problem.
Could you give me some idea how to solve it?
【在 D******n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : u might get it wrong. : it is not a orthogonal partition of the population. : think about this, ppl have diseases, A,B and C.
|
l****u 发帖数: 529 | 5 I had made a table like that but needed several steps. There must be
easier
methods.
%macro diseasecount(var);
proc sql;
create table &var as
select "&var" as name, sum(A) as A,sum(B) as B,sum(C) as C ....
from yourdata
where &var.=1;
quit;
%mend;
%diseasecount(A)
%diseasecount(B)
%diseasecount(C)
.
.
.
data final;
set A
B
C......;
run;
|
j******o 发帖数: 127 | |
j*********9 发帖数: 161 | 7 表达能力不太好,希望大家能看得懂。
n个variable代表n种疾病,1表示有病,“.”表示无此病。observation有3万多。
想最后得到一张n*n的表,能显示各种疾病的count以及任意两种疾病都有的count。我
用proc freq试了半天,能得到数据,就是不能弄成一张满意的表。
Help please!包子虽然不多,愿全部奉送!
|
D******n 发帖数: 2836 | 8 u might get it wrong.
it is not a orthogonal partition of the population.
think about this, ppl have diseases, A,B and C.
【在 j*********9 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 表达能力不太好,希望大家能看得懂。 : n个variable代表n种疾病,1表示有病,“.”表示无此病。observation有3万多。 : 想最后得到一张n*n的表,能显示各种疾病的count以及任意两种疾病都有的count。我 : 用proc freq试了半天,能得到数据,就是不能弄成一张满意的表。 : Help please!包子虽然不多,愿全部奉送! :
|
A*******s 发帖数: 3942 | 9 market basket/association rules mining
【在 j*********9 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 表达能力不太好,希望大家能看得懂。 : n个variable代表n种疾病,1表示有病,“.”表示无此病。observation有3万多。 : 想最后得到一张n*n的表,能显示各种疾病的count以及任意两种疾病都有的count。我 : 用proc freq试了半天,能得到数据,就是不能弄成一张满意的表。 : Help please!包子虽然不多,愿全部奉送! :
|
j*********9 发帖数: 161 | 10 I am sorry that i do not get it.
Do you mean people can not have so many diseases?
My project is based on real data. People are new born babies and disease are all kinds of birth defects. So, this should not be a problem.
Could you give me some idea how to solve it?
【在 D******n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : u might get it wrong. : it is not a orthogonal partition of the population. : think about this, ppl have diseases, A,B and C.
|
|
|
l****u 发帖数: 529 | 11 I had made a table like that but needed several steps. There must be
easier
methods.
%macro diseasecount(var);
proc sql;
create table &var as
select "&var" as name, sum(A) as A,sum(B) as B,sum(C) as C ....
from yourdata
where &var.=1;
quit;
%mend;
%diseasecount(A)
%diseasecount(B)
%diseasecount(C)
.
.
.
data final;
set A
B
C......;
run;
|
j******o 发帖数: 127 | |
o****o 发帖数: 8077 | 13 taking . as 0, this is the SSCP matrix, and can easily be obtained via PROC
CORR
here is an example:
data x;
input x1-x5;
cards;
1 . 1 1 .
. 1 1 1 .
1 1 1 1 1
. . . . .
. 1 . . 1
. 1 . . .
1 . 1 . .
. . 1 . .
. . . 1 .
. . 1 . 1
;
run;
proc corr data=x
out=sscp(where=(_TYPE_="SSCP" & _NAME_^="Intercept") drop=Intercept)
sscp
noprint;
var x1-x5;
run;
【在 j*********9 的大作中提到】![](/moin_static193/solenoid/img/up.png) : I am sorry that i do not get it. : Do you mean people can not have so many diseases? : My project is based on real data. People are new born babies and disease are all kinds of birth defects. So, this should not be a problem. : Could you give me some idea how to solve it?
|
j*********9 发帖数: 161 | 14 very useful code, easy to apply!
Thank you very much!
And accept Baozi, please!
【在 j******o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Check your message.
|
j*********9 发帖数: 161 | 15 That is the easiest way to solve this problem.
Thank you very much!
And, Baozi!
PROC
【在 o****o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : taking . as 0, this is the SSCP matrix, and can easily be obtained via PROC : CORR : here is an example: : data x; : input x1-x5; : cards; : 1 . 1 1 . : . 1 1 1 . : 1 1 1 1 1 : . . . . .
|
j*********9 发帖数: 161 | 16 Now, I do not have any decent Baozi left.
Actually I tried proc tabulate first, which can give me the numbers i want
and they are all in one table, but it has extra columns and rows. So
frustrating.... |
z**********i 发帖数: 12276 | 17 收藏拉,谢谢!
PROC
【在 o****o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : taking . as 0, this is the SSCP matrix, and can easily be obtained via PROC : CORR : here is an example: : data x; : input x1-x5; : cards; : 1 . 1 1 . : . 1 1 1 . : 1 1 1 1 1 : . . . . .
|
l****u 发帖数: 529 | |
s*r 发帖数: 2757 | 19 我在ods table里面找了半天没找到,这个和proc glm不一样呀
PROC
【在 o****o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : taking . as 0, this is the SSCP matrix, and can easily be obtained via PROC : CORR : here is an example: : data x; : input x1-x5; : cards; : 1 . 1 1 . : . 1 1 1 . : 1 1 1 1 1 : . . . . .
|