由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - a SAS problem
相关主题
About ID in sas请教一个SAS Macro问题。谢谢
请教:三道SAS BASE题SAS Regression Macro 问题请教 (有包子)
请问两道sas adv的题..SAS ADVANCED 一道题求助
问一个sas改大量的variable name的问题SAS call symput question
新人报道,兼问SAS data set的问题ask for help (urgent): A SAS question
SAS问题请教请教一道SAS maro的题
help for one simple SAS DATA请教SAS adv 题库一道macro题
NEED HELP: write do loop in SAS for a project问一些sas的问题
相关话题的讨论汇总
话题: 12话题: tr01话题: tr28话题: sum话题: variables
进入Statistics版参与讨论
1 (共1页)
m****r
发帖数: 202
1
My question is
if the variable has the suffix _12, the sum can't be shorted as
(of TR01_12-TR28_12) or
(of TR01_12--TR28_12).
I have to present all the variables like the following
all = sum ( of TR01 - TR33 );
all_12=sum(TR01_12,TR02_12,TR03_12,TR04_12,TR05_12,TR06_12,TR07_12,TR08_12,
TR09_12,TR10_12
TR11_12,TR12_12,TR13_12,TR14_12,TR15_12,TR16_12,TR17_12,TR18_12,TR19_12,TR20
_12
TR21_12,TR22_12,TR23_12,TR24_12,TR25_12,TR26_12,TR27_12,TR28_12);
Do you have a better way for all_12 ?
Thanks
s******r
发帖数: 1524
2
I am lazy and stupid and have no idea of smart way.
I would use macro to do that.

TR20

【在 m****r 的大作中提到】
: My question is
: if the variable has the suffix _12, the sum can't be shorted as
: (of TR01_12-TR28_12) or
: (of TR01_12--TR28_12).
: I have to present all the variables like the following
: all = sum ( of TR01 - TR33 );
: all_12=sum(TR01_12,TR02_12,TR03_12,TR04_12,TR05_12,TR06_12,TR07_12,TR08_12,
: TR09_12,TR10_12
: TR11_12,TR12_12,TR13_12,TR14_12,TR15_12,TR16_12,TR17_12,TR18_12,TR19_12,TR20
: _12

T*******I
发帖数: 5138
3
为什么你不将你的变量名改成一下序列:
(of TR12_01-TR12_28) ?????

【在 m****r 的大作中提到】
: My question is
: if the variable has the suffix _12, the sum can't be shorted as
: (of TR01_12-TR28_12) or
: (of TR01_12--TR28_12).
: I have to present all the variables like the following
: all = sum ( of TR01 - TR33 );
: all_12=sum(TR01_12,TR02_12,TR03_12,TR04_12,TR05_12,TR06_12,TR07_12,TR08_12,
: TR09_12,TR10_12
: TR11_12,TR12_12,TR13_12,TR14_12,TR15_12,TR16_12,TR17_12,TR18_12,TR19_12,TR20
: _12

h********o
发帖数: 103
4
If your variables appear in the order of TR01_12, TR02_12,...,TR12_12 in the
data set, you can use Name Range Lists as
all = sum(of tr01_12 -- tr12_12);
m****r
发帖数: 202
5
Thank you for your kindly reply.
1. I have baseline, 12mon, 18mon variables, that's way the variables are
named tr01-tr28,tr01_12-tr28_12,tr01_18-tr28_18
2. Macro can't be used here
3.when I use "all = sum(of tr01_12 - tr28_12);" the log said"
ERROR: Alphabetic prefixes for enumerated variables (tr01_12 - tr28_12)
are different.
ERROR 71-185: The SUM function call does not have enough arguments."
4.These variables are physically seperated,so I can't use
"all = sum(of tr01_12 -- tr28_12);"
Thank you again
h********o
发帖数: 103
6
Try following code to change variable names then use SUM funciton.
===========
%MACRO RENAME(INDEX);
RENAME
%DO I = 1 %TO 9;
TR0&I._&INDEX = TR&INDEX._0&I
%END;
%DO I = 10 %TO 28;
TR&I._&INDEX = TR&INDEX._&I
%END;
%MEND;
DATA TEST;
SET yourdata;
%RENAME(12);
%RENAME(18);
RUN;
l****u
发帖数: 529
7
Under such circumstance, you can rearrange the sequence of your variables,
just making no separations between tr01_12--tr28_12.
1 (共1页)
进入Statistics版参与讨论
相关主题
问一些sas的问题新人报道,兼问SAS data set的问题
求教sas adv题目SAS问题请教
[合集] 问个SAS的问题help for one simple SAS DATA
求教proc sql 问题NEED HELP: write do loop in SAS for a project
About ID in sas请教一个SAS Macro问题。谢谢
请教:三道SAS BASE题SAS Regression Macro 问题请教 (有包子)
请问两道sas adv的题..SAS ADVANCED 一道题求助
问一个sas改大量的variable name的问题SAS call symput question
相关话题的讨论汇总
话题: 12话题: tr01话题: tr28话题: sum话题: variables