由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 请教一个call symput的问题
相关主题
sas macro 问题请教。。请教一个macro的问题
[合集] 一个sas问题SAS ADVANCED 一道题求助
请帮忙看3道SAS题。sas macro 问题,
问个SAS题目,SAS call symput question
killtest Q78 79 80求助,SAS ADV 130 中94
SAS help请问SAS ADV 130中74 和80题
一道ADV 130 题目a question about SAS
请问SAS advanced macro global 和local【包子】求问个简单sas macro问题
相关话题的讨论汇总
话题: symput话题: trt话题: compress话题: count话题: call
进入Statistics版参与讨论
1 (共1页)
a******p
发帖数: 414
1
下面是我的code:
data new;
set old end=last;
retain total;
if _n_=1 then all=0;
call symput(trt,compress(count));
all=all+count;
if last then call symput('all', compress(all));
run;
这里trt 是treatment,有四个值。
我想请问,call symput(trt,compress(count)); 不能用在macro中么?只能用在data
step?
下面是我想要的。
%macro count(data=,var=);
data new;
set old end=last;
retain total;
if _n_=1 then all=0;
call symput(trt,compress(count));
all=all+count;
if last then call symput('all', compress(all));
run;
%mend;
非常感谢!
f*******n
发帖数: 2665
2
不需要放入宏中。
call symput( 'trt'||put(trt,1.),.......

【在 a******p 的大作中提到】
: 下面是我的code:
: data new;
: set old end=last;
: retain total;
: if _n_=1 then all=0;
: call symput(trt,compress(count));
: all=all+count;
: if last then call symput('all', compress(all));
: run;
: 这里trt 是treatment,有四个值。

a******p
发帖数: 414
3
非常感谢你的回答。但我的这段code是在一个大的宏里面。

【在 f*******n 的大作中提到】
: 不需要放入宏中。
: call symput( 'trt'||put(trt,1.),.......

P****D
发帖数: 11146
4
你写的逻辑不对罢了。一个宏变量只能有一个值。例如你要count的第一个值成为宏变
量trt,那就 if _n_=1 then do; call symput('trt', compress(count)); end;
a******p
发帖数: 414
5
下面是我的code:
data new;
set old end=last;
retain total;
if _n_=1 then all=0;
call symput(trt,compress(count));
all=all+count;
if last then call symput('all', compress(all));
run;
这里trt 是treatment,有四个值。
我想请问,call symput(trt,compress(count)); 不能用在macro中么?只能用在data
step?
下面是我想要的。
%macro count(data=,var=);
data new;
set old end=last;
retain total;
if _n_=1 then all=0;
call symput(trt,compress(count));
all=all+count;
if last then call symput('all', compress(all));
run;
%mend;
非常感谢!
f*******n
发帖数: 2665
6
不需要放入宏中。
call symput( 'trt'||put(trt,1.),.......

【在 a******p 的大作中提到】
: 下面是我的code:
: data new;
: set old end=last;
: retain total;
: if _n_=1 then all=0;
: call symput(trt,compress(count));
: all=all+count;
: if last then call symput('all', compress(all));
: run;
: 这里trt 是treatment,有四个值。

a******p
发帖数: 414
7
非常感谢你的回答。但我的这段code是在一个大的宏里面。

【在 f*******n 的大作中提到】
: 不需要放入宏中。
: call symput( 'trt'||put(trt,1.),.......

P****D
发帖数: 11146
8
你写的逻辑不对罢了。一个宏变量只能有一个值。例如你要count的第一个值成为宏变
量trt,那就 if _n_=1 then do; call symput('trt', compress(count)); end;
a******p
发帖数: 414
9
谢谢你的回复,但我没有写错。
如果我这样写,其中 trt 是变量,取值例如 placebo, active1, active 2,
call symput(trt, compress(count))
那么我是可以生成三个宏变量的: &placebo, &active1,&active2
如果加上引号call symput('trt', compress(count));
那么只能生产一个宏变量

【在 P****D 的大作中提到】
: 你写的逻辑不对罢了。一个宏变量只能有一个值。例如你要count的第一个值成为宏变
: 量trt,那就 if _n_=1 then do; call symput('trt', compress(count)); end;

1 (共1页)
进入Statistics版参与讨论
相关主题
【包子】求问个简单sas macro问题killtest Q78 79 80
请教SAS adv 题库一道macro题SAS help
sas题目恳请前辈指点!!一道ADV 130 题目
在线等:急问大牛帮我看看SAS macro里的问题请问SAS advanced macro global 和local
sas macro 问题请教。。请教一个macro的问题
[合集] 一个sas问题SAS ADVANCED 一道题求助
请帮忙看3道SAS题。sas macro 问题,
问个SAS题目,SAS call symput question
相关话题的讨论汇总
话题: symput话题: trt话题: compress话题: count话题: call