s******r 发帖数: 1524 | 1 proc sort data=test;by var1 descending var3 ;run;
data t1;
set test;
by var1;
if first.var1 then do;
if var3>0 then varx=var3;else varx=.;
end;
var4=max(var3,varx);
retain varx;
drop varx;
run;
|
|
w********n 发帖数: 33 | 2 有两个数据子集,左边数据变量VarX的某些值是空缺的。
ID Doc# VarX ID Doc# VarY
1 234 abab 1 467 abcd
1 121 1 121 A
1 121 2 789 B
1 112 cdse 3 909 asde
2 789 3 900 asdu
2 234 rtfg ... ... ....
2 345 pgpg
... ... ....
需要把以上左边的数据生成如下格式,把空缺的VarX值从右边的VarY值通过Doc#补充进
来,Doc#值是unique的控制变量,对应唯一的VarX或者VarY。
ID Doc# VarX
1 234 abab
1 ... 阅读全帖 |
|
d*********a 发帖数: 255 | 3 for any k > 1, Let P(X=-1)=1/(2k^2) ,P(X=0)=1-1/k^2, P(X=1)=1/(2k^2)
EX=0 VarX=1/k^2 sigma=1/k
Chebyshev's inequality :P(|X-EX|>=k*sigma)<=VarX/(k*sigma)^2
In this case, P(|X-EX|>=k*sigma)=P(|X|>=1)=P(X=-1)+P(X=1)=1/k^2
VarX/(k*sigma)^2=1/k^2
They are equal.
the bound can not be improved.
. |
|
s******r 发帖数: 1524 | 4 data c;
merge a b;by Doc;
if varx='' then var=vary;else var=varx;
drop varx vary;
run; |
|
k**y 发帖数: 920 | 5 sigma_x和sigma_y是std对吧?
let Y'=X+Y
then EY'=mu_x+mu_y
std(Y')=sqrt(varX+varY+2rho*sigma_x*sigm_y)
Cov(X,Y')=Cov(X,X+Y)=varX+Cov(X,Y)=sigma_x^2+rho*sigma_x*simga_y
根据Normal Dist条件分布的公式
E(X|Y'=z) = mu_x + sigma_x/std(Y')*corr(X,Y')*(z-EY')
= mu_x + Cov(X,Y')/std(Y')^2 *(z-mu_x-my_y)
= mu_x + (sigma_x^2+rho*sigma_x*sigma_y)/(sigma_x^2+sigma_y^2+2rho
*sigma_x*sigma_y *(z-mu_x_mu_y)
z |
|
x**m 发帖数: 941 | 6 try compress(varX, " 123") when varX is in the original format. |
|
p********o 发帖数: 25 | 7 第一题没想到简单方法,主要是求 E(X^2 Y^2)= (EXY+1)^2 - 2EXY -1, EXY = EX*EY+
2\rho sqrt(VarX*VarY)。求出来就差不多了。
第二题用交换积分,把E放到积分号里面去就可以得到答案。 |
|
r********0 发帖数: 22 | 8 let me guess, Var1-5 are the main effects, VAR1T-5T are the names you would
like to assign to the time-dependent variables. Shouldn't the programming
statemnet be &VARxT=&VARx*log(surv)? |
|
g*******y 发帖数: 380 | 9 Hi,all
I have a question as below:
I want count the total number of non-missing value for several variables by
year.
Suppose the dataset looks like this:
year varA varB varX varP....
I know I can do proc freq...; tables year*varA;
or proc sql;.. count(varA) as..;group by year;...
But how can I do it for several variables at once and get a single table?
Thank you in advance. |
|