由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - how to write a series of variables Q29B4B-Q29B30B in array ?
相关主题
问一个sas改大量的variable name的问题发包子求大牛解SAS问题,急
question about using sas macro variable and do loop一个关于macro的问题,多谢。
求教一个sas读data的问题[help]10个包子求KDD cup 2009 的orange公司dataset
如何比较两个proc contents的结果?SAS code help!! thanks
how to get variable names and # of variable names in sas datasetHelp! A data step problem
SAS SQL 问题在 R 里面如何循环调用变量名
sas新手求救,合并databasesHow to set initial dataset to zero in a SAS macro?
SAS 问题:关于比较variable 包子答谢Help: an I/O ERROR occured
相关话题的讨论汇总
话题: q29b4b话题: q29b30b话题: array话题: lastletter话题: variables
进入Statistics版参与讨论
1 (共1页)
s********8
发帖数: 50
1
Q29B4B-Q29B30B are not next to each other in dataset
and Q29B4B Q29B5B Q29B6B----Q29B30B need to be an array .
do I have to put one by one ?
I alreasy tried Q29B4B-Q29B30B , it didn't work.
ask for help !
k*******a
发帖数: 772
2
%macro names;
%do i=4 %to 30;
Q29B&i.B
%end;
%mend;
data a;
input %names;
.......
s********8
发帖数: 50
3
thanks !
but what I want is put them in an array.
Array abc(*) Q29B4B--Q29B30B (if they are next to each other in dataset.
and
Array abc(*) Q29B4B-Q29B30B (in SAS, it didn't work out)
so I am thinking if there is a smart way to do instead of
Array abc(*) Q29B4B Q29B5B Q29B6B,,,,,,,,,,,Q29B30B (type one by one)
any hint?
thanks

【在 k*******a 的大作中提到】
: %macro names;
: %do i=4 %to 30;
: Q29B&i.B
: %end;
: %mend;
: data a;
: input %names;
: .......

k*******a
发帖数: 772
4
That's same thing
just replace those names with %names
if you use the macro

【在 s********8 的大作中提到】
: thanks !
: but what I want is put them in an array.
: Array abc(*) Q29B4B--Q29B30B (if they are next to each other in dataset.
: and
: Array abc(*) Q29B4B-Q29B30B (in SAS, it didn't work out)
: so I am thinking if there is a smart way to do instead of
: Array abc(*) Q29B4B Q29B5B Q29B6B,,,,,,,,,,,Q29B30B (type one by one)
: any hint?
: thanks

d*******o
发帖数: 493
5
%let lastletter = B;
Array abc(*) Q29B4&lastletter--Q29B30&lastletter;
m*****a
发帖数: 658
6
Array abc(*) Q29B:;
select all the variables initial with Q29B.
Hope it helps.
s********8
发帖数: 50
7
Thanks for thinking for it , it is a good trial.
but after I tried the code below, I didn;t think it worked.
data Farray;
length Q29B4B A Q29B5B B Q29B6B C Q29B7B D Q29B8B E Q29B9B F Q29B10B G
Q29B11B H Q29B12B I Q29B13B G Q29B14B K Q29B15B $8;
%let lastletter = B;
Array Ftesta(*) Q29B4&lastletter--Q29B15&lastletter;
Array Ftestb(*) Q29B4&lastletter-Q29B15&lastletter;
K=DIM(Ftesta);
P=DIM(Ftestb);
put K= P=;
run;
in LOG K=22 instead of 12;
and P can not get any value since
ERROR: Missing numeric suffix on a numbered variable list (Q29B4B-Q29B15B).
I will try the other way .
invite you all for this game , :).
Thanks!

【在 d*******o 的大作中提到】
: %let lastletter = B;
: Array abc(*) Q29B4&lastletter--Q29B30&lastletter;
:

1 (共1页)
进入Statistics版参与讨论
相关主题
Help: an I/O ERROR occuredhow to get variable names and # of variable names in sas dataset
求一个简单点的方法写一段SASSAS SQL 问题
一个SAS Macro和Append的问题,救助!sas新手求救,合并databases
用尽心思做好了一个macroSAS 问题:关于比较variable 包子答谢
问一个sas改大量的variable name的问题发包子求大牛解SAS问题,急
question about using sas macro variable and do loop一个关于macro的问题,多谢。
求教一个sas读data的问题[help]10个包子求KDD cup 2009 的orange公司dataset
如何比较两个proc contents的结果?SAS code help!! thanks
相关话题的讨论汇总
话题: q29b4b话题: q29b30b话题: array话题: lastletter话题: variables