SAS中文论坛

标题: 《求助》 关于array 的问题。 [打印本页]

作者: shiyiming    时间: 2010-11-9 00:52
标题: 《求助》 关于array 的问题。
麻烦大家帮忙看一下下面的array code. 新手. 谢谢先!

The following is the code.

data tryarray ;
set cau2006.rica(keep=baseid H_pdtp01-H_pdtp12 H_GHPSW);
array mapd[12] H_PDTP01-H_PDTP12;
array pdp[12] H_PDTP01-H_PDTP12;

do i=1 to 12;
mapd[i]=(mapd[i]=1);
pdp[i]=(pdp[i]=2);
end;

if max(of mapd1-mapd12)=1 then pd=1;
else if max(of pdp1-pdp12)=1 then pd=2;
else pd=0;
run;

proc freq data=tryarray;
table pd*h_ghpsw;
run;


the problem is

NOTE: Variable mapd1 is uninitialized till mapd12 is uninitialized. the same as the variable pdp

NOTE: Variable pdp1 is uninitialized. till pdp12 is uninitialized.
作者: Qiong    时间: 2010-11-11 15:59
标题: Re: 《求助》 关于array 的问题。
if max(of mapd1-mapd12)=1 then pd=1;
else if max(of pdp1-pdp12)=1 then pd=2;
else pd=0;
run;

没有mapd1-mapd12这个变量阿~~~
你如果为了得到pd,可以在i循环的时候直接得到吧~~~

Btw,目的是pd的话,用sql可能更好~~




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2