t*****l 发帖数: 11 | 1 我有如下这样一个dataset,每个variable repeat measurement 3-6 次, 想要对所有
variable求它们各自repeat的mean, variable数多于300, 如何用short cut refer
所有variable?
可能很菜鸟的问题, 不过我google了半天也没找到, 恳请指点一二, 如果用data
step 又如何处理?
id v1 v2 v3 ...
1001 1 2 5
1001 1 2 5
1001 1 2 5
1002 3 4 6
1002 3 4 6
1002 3 4 6
1002 3 4 6
...
比如如何修改如下code?
proc sql;
create table t as
select avg (v1 -- v3) as (m1 -- m3) *This can not work..
from work.xx
group by id;
quit;
多谢 |
p********a 发帖数: 5352 | 2 proc means data=a mean;
var v1--var300;
output out=b ;
run; |
p********a 发帖数: 5352 | 3 具体参数你自己GOOGLE一下PROC MEANS |
g*********o 发帖数: 20357 | 4 My SAS just expired, so I can't try it. Can you try this yourself?
Instead of (m1 -- m3), put (m1 - m3), because I saw a line of code of
" rename=(a1-a10=base_a1-base_a10) ".
proc sql;
create table t as
select avg (v1 -- v3) as (m1 - m3)
from work.xx
group by id;
quit; |
g*********o 发帖数: 20357 | 5 版主有空帮我看看那个ADJUDICATION问题?谢谢
【在 p********a 的大作中提到】 : proc means data=a mean; : var v1--var300; : output out=b ; : run;
|
h******e 发帖数: 1791 | 6 试试把“--”改为“-”。
【在 t*****l 的大作中提到】 : 我有如下这样一个dataset,每个variable repeat measurement 3-6 次, 想要对所有 : variable求它们各自repeat的mean, variable数多于300, 如何用short cut refer : 所有variable? : 可能很菜鸟的问题, 不过我google了半天也没找到, 恳请指点一二, 如果用data : step 又如何处理? : id v1 v2 v3 ... : 1001 1 2 5 : 1001 1 2 5 : 1001 1 2 5 : 1002 3 4 6
|
c*******o 发帖数: 3829 | 7 You can use SAS even it expired: change your computer's date back to the
period your SAS was licensed and launch SAS.
【在 g*********o 的大作中提到】 : My SAS just expired, so I can't try it. Can you try this yourself? : Instead of (m1 -- m3), put (m1 - m3), because I saw a line of code of : " rename=(a1-a10=base_a1-base_a10) ". : proc sql; : create table t as : select avg (v1 -- v3) as (m1 - m3) : from work.xx : group by id; : quit;
|
t*****l 发帖数: 11 | 8 谢谢斑竹提醒, 用下面的code能够直接得到我想要得dataset, 不用带很多别的自动
variable
proc means data =aa noprint;
class id;
var v1 -- v3;
output out=bb(drop=_TYPE_ _FREQ_ where =(id ne .)) MEAN= ;
run;
回头再看看proc sql怎么做
【在 p********a 的大作中提到】 : proc means data=a mean; : var v1--var300; : output out=b ; : run;
|
t*****l 发帖数: 11 | 9 Thank you, I tried, but it doesn't work. I saw what you mention about the
short-cut in the rename statement too, but seemingly not for calculation in
Proc Sql.
proc sql;
create table Baseline_A_1 as
select subject_id,
a1 as base_a1,
/* .. etc. .. , */
a10 as base_a10
from Scores
where visit=1;
create table baseline_A_2 as
select *
from Scores(rename=(a1-a10=base_a1-base_a10) drop=b:)
where visit=1;
quit;
【在 g*********o 的大作中提到】 : My SAS just expired, so I can't try it. Can you try this yourself? : Instead of (m1 -- m3), put (m1 - m3), because I saw a line of code of : " rename=(a1-a10=base_a1-base_a10) ". : proc sql; : create table t as : select avg (v1 -- v3) as (m1 - m3) : from work.xx : group by id; : quit;
|