由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - help on a sas question
相关主题
a sas merge question请教一个sas macro的问题
从大data 产生多个小data 的方法SAS code 问题
SAS菜鸟请教如果使SAS的output的结果放到一个文件内?A SAS question, please help!
question about using sas macro variable and do loop神奇的proc means
how to trasform data.求问SAS技术问题,one row to multiple row
请教proc freq 的chisq 分析Sas问题, 有包子
问一个数据分析的问题SAS help...
如何重复运行sas程序100次,并把100次的结果全部output?请教SAS split data的问题
相关话题的讨论汇总
话题: f1话题: output话题: v3话题: v1话题: sas
进入Statistics版参与讨论
1 (共1页)
j*******i
发帖数: 97
1
can I get some help?
I have a dataset.
obs v1 v2 v3 f1
1 4 5 6 1
2 2 3 9 3
3 2 5 7 2
column f1 indicates the variable version to use.
for exmaple, first row, f1=1, then we need to use the value of v1 (output
the value: 4)
second row, f1=3, then we need to use the value of v3 (output
the value: 9)
and so on...
the output result needs to be a sas dataset that contains all the outputs;
What's the most efficient way to create the output?
Thank you very much.
sorry. cannot type Chinese for now.
w****r
发帖数: 28
2
array…
j*******i
发帖数: 97
3
can you elaborate a little bit?
Dumping v1-v3 as an array?
doable but does not seem to be efficient in terms of storage.

【在 w****r 的大作中提到】
: array…
a****g
发帖数: 8131
4
%let a = f1
in a macro, have the following
v = v&a; output;
this should work

【在 j*******i 的大作中提到】
: can I get some help?
: I have a dataset.
: obs v1 v2 v3 f1
: 1 4 5 6 1
: 2 2 3 9 3
: 3 2 5 7 2
: column f1 indicates the variable version to use.
: for exmaple, first row, f1=1, then we need to use the value of v1 (output
: the value: 4)
: second row, f1=3, then we need to use the value of v3 (output

k*****u
发帖数: 45
5
刚学macro和sql不久,想了个笨办法,lz找到了更好的办法的话不要笑我。。。
data a;
input v1 v2 v3 f1;
datalines;
4 5 6 1
2 3 9 3
2 5 7 2
;
run;
%macro test;
proc sql;
alter table a
add v num
;
%do i=1 %to 3;
update a
set v=v&i
where a.f1=&i
;
%end;
quit;
%mend;
%test;

【在 j*******i 的大作中提到】
: can I get some help?
: I have a dataset.
: obs v1 v2 v3 f1
: 1 4 5 6 1
: 2 2 3 9 3
: 3 2 5 7 2
: column f1 indicates the variable version to use.
: for exmaple, first row, f1=1, then we need to use the value of v1 (output
: the value: 4)
: second row, f1=3, then we need to use the value of v3 (output

w****r
发帖数: 28
6
data a;
input v1 v2 v3 f1;
datalines;
4 5 6 1
2 3 9 3
2 5 7 2
run;
data b;
set a;
array v[1:3] v1-v3;
newvalue = v[f1];
run;
j*******i
发帖数: 97
7
this one works. I will send you BaoZi.
thanks.

【在 w****r 的大作中提到】
: data a;
: input v1 v2 v3 f1;
: datalines;
: 4 5 6 1
: 2 3 9 3
: 2 5 7 2
: run;
: data b;
: set a;
: array v[1:3] v1-v3;

1 (共1页)
进入Statistics版参与讨论
相关主题
请教SAS split data的问题how to trasform data.
a question about sas coding请教proc freq 的chisq 分析
请教一sas code问一个数据分析的问题
Why the output data set does not give median?如何重复运行sas程序100次,并把100次的结果全部output?
a sas merge question请教一个sas macro的问题
从大data 产生多个小data 的方法SAS code 问题
SAS菜鸟请教如果使SAS的output的结果放到一个文件内?A SAS question, please help!
question about using sas macro variable and do loop神奇的proc means
相关话题的讨论汇总
话题: f1话题: output话题: v3话题: v1话题: sas