由买买提看人间百态

topics

全部话题 - 话题: symput
1 2 3 下页 末页 (共3页)
a******p
发帖数: 414
1
来自主题: Statistics版 - 请教一个call symput的问题
下面是我的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;... 阅读全帖
a******p
发帖数: 414
2
来自主题: Statistics版 - 请教一个call symput的问题
下面是我的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;... 阅读全帖
h********o
发帖数: 103
3
来自主题: Statistics版 - SAS call symput question
You example is a case of using CALL SYMPUT with complete DATA step and a
nonempty Local Symbol Table since you have a paramter. then your new created
macro variable is local to that data step. you can define the macro
variable as global macro variable or use it within an incomplete DATA step.
===========
%let list=2;
%macro test(one_var);
data _null_;
if "&one_var"="1" then call symput("sss", "&list");
%mend;
run;
%test(1)
%put &sss;
If you use CALL SYMPUT with a complete DATA step and an em... 阅读全帖
n****u
发帖数: 229
4
来自主题: Statistics版 - SAS call symput question
I am testing a program.
%let one_var=1;
%let list=2;
data _null_;
if "&one_var"="1" then call symput("sss", "&list");
run;
%put &sss;
So the SSS=2 since one_var=1.
When I put macro outside of these codes, it fails.
%let list=2;
%macro test(one_var);
data _null_;
if "&one_var"="1" then call symput("sss", "&list");
run;
%mend;
%test(1)
%put &sss;
Advice please, thanks.
n**m
发帖数: 156
5
来自主题: Statistics版 - SAS call symput question
call symput is for transferring value from a variable in a dataset to a
macro variable.
should be like this
data _null_;
set dataset;
if _n_=1 then call symput("macro variable name", var_name);
run;
a******p
发帖数: 414
6
来自主题: Statistics版 - 请教一个call symput的问题
谢谢你的回复,但我没有写错。
如果我这样写,其中 trt 是变量,取值例如 placebo, active1, active 2,
call symput(trt, compress(count))
那么我是可以生成三个宏变量的: &placebo, &active1,&active2
如果加上引号call symput('trt', compress(count));
那么只能生产一个宏变量
o******6
发帖数: 538
7
☆─────────────────────────────────────☆
jstmj2002 (Jeff) 于 (Fri Mar 6 16:36:10 2009) 提到:
data one;
input group $ sum@@;
cards;
A 765 B 123 C 564
;
run;
data _null_;
set one;
call symput(group,sum);
stop;run;
what is the result when the program finishes execution?
A. MACRO variable A has a value of 765
B. MACRO variable C has a value of 564
C. MACRO variable GROUP has a value of 564
D. MACRO variable A has a value of SUM
the answer is A.
why not B?
'stop' statement 在这里有影响吗?请指点一二,谢谢!
☆──────
s******r
发帖数: 1524
8
call execute('global var');
call symput('');
j*********a
发帖数: 232
9
来自主题: Statistics版 - 急问一个call symput问题(SAS)
想在macro中的data step干以下事:
call symput ('var&i', value);
但那个&i怎么放都不对,没法得到var1,var2...
请高手指教。
a********s
发帖数: 188
10
来自主题: Statistics版 - 急问一个call symput问题(SAS)
call symput ("var"||left(&i), value);
s******r
发帖数: 1524
11
来自主题: Statistics版 - SAS call symput question
%let list=2;
%macro test(one_var);
%global sss;
data _null_;
if &one_var=1 then call symput("sss", "&list");
run;
%mend;
%test(1)
%put &sss;
baozi pls.
s******r
发帖数: 1524
12
来自主题: Statistics版 - SAS call symput question
SAS的逻辑不是那么容易follow的。
try
%let one_var=1;
%let list=2;
%macro test;
data _null_;
if &one_var=1 then call symput("sss2", "&list");
run;
%mend;
%test;
%put &sss2;

you
n**m
发帖数: 156
13
来自主题: Statistics版 - SAS call symput question
try this. as little birds said, it is a scope issue.
%let one_var=1;
%let list=2;
%macro test(one_var);
%global sss;
data _null_;
if "&one_var"="1" then call symput("sss", "&list");
run;
%mend;
%test(1)
%put &sss;
f*******n
发帖数: 2665
14
来自主题: Statistics版 - 请教一个call symput的问题
不需要放入宏中。
call symput( 'trt'||put(trt,1.),.......
P****D
发帖数: 11146
15
来自主题: Statistics版 - 请教一个call symput的问题
你写的逻辑不对罢了。一个宏变量只能有一个值。例如你要count的第一个值成为宏变
量trt,那就 if _n_=1 then do; call symput('trt', compress(count)); end;
f*******n
发帖数: 2665
16
来自主题: Statistics版 - 请教一个call symput的问题
不需要放入宏中。
call symput( 'trt'||put(trt,1.),.......
P****D
发帖数: 11146
17
来自主题: Statistics版 - 请教一个call symput的问题
你写的逻辑不对罢了。一个宏变量只能有一个值。例如你要count的第一个值成为宏变
量trt,那就 if _n_=1 then do; call symput('trt', compress(count)); end;
w*****1
发帖数: 473
18
来自主题: Economics版 - a question about SAS (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: wz99331 (dotti), 信区: Statistics
标 题: a question about SAS
发信站: BBS 未名空间站 (Mon Apr 2 12:52:18 2012, 美东)
我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std w... 阅读全帖
w*****1
发帖数: 473
19
来自主题: Pharmacy版 - a question about SAS (转载)
【 以下文字转载自 Statistics 讨论区 】
发信人: wz99331 (dotti), 信区: Statistics
标 题: a question about SAS
发信站: BBS 未名空间站 (Mon Apr 2 12:52:18 2012, 美东)
我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std w... 阅读全帖
d**********o
发帖数: 1321
20
来自主题: Statistics版 - 请教 sas functions
再问一下:
proc contents data=dqa.ni_adjustment_factor; run;
ERROR: File DQA.NI_ADJUSTMENT_FACTOR.DATA does not exist.
保留版本work.ni_adjustment_factor_200901 (&per1=200901)是可以manipulate的。repeated run of "%varname;" will overwrite work.ni_adjustment_factor_200901.
而dqa libname中明明看见数据在,而且可以打开数据表,为什么用code就不能access呢?
而且dqa中存几个同样名字dqa.ni_adjustment_factor同样大小的表(repeated run of %varname;)sas并不识别?
dqa.ni_adjustment_factor是这么建的:
%macro varname;
data _null_;
set varname end=last;
call symput... 阅读全帖
w*****1
发帖数: 473
21
来自主题: Statistics版 - a question about SAS
我需要用MACRO 语言,用DO LOOP 改变一个模版的5个固定参数创建一些新的DATA,检
测这些新的DATA最大似然值.下面是我的CODE, 但是不能运行,大家能否帮我看看?包子
酬谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
/* Do loops for grid search */
/*Y=g+R(mixed model), where g=Major Gene(latent fixed effect)with 3
values: mudaa, mudab, mudbb and R = Residual(variance component)*/
/*the max, min, and std will be used as grid search ranges */
%macro loops;
proc means data=parents;
var QTP;
output out=range min=min max=max std=std mean=mean;
... 阅读全帖
p*******r
发帖数: 1951
22
来自主题: Statistics版 - 请教SAS adv 题库一道macro题
对于这一题我的理解是:首先,%let 定义 date 为一个 global macro variable。 然
后用一个 call symput 语句重新给date 赋值。这时候date 作为一个global macro
variable的值变为call symput赋予的值。
我觉得出这个题的目的只是考察全局宏变量定义,以及在macro内改变全局宏变量的值
对于全局宏变量的影响。而对于call symput定义macro variable的scope,需要更深一
步的解释。参见这个链接。
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML
在这道题里面,就像上面的兄弟说的,因为macro two没有parameter,call symput定
义的date是全局宏变量。但就算macro two有parameter,call symput运行后全局宏变
量date 的值依然会被改变。
这个题目出的很好。
a****r
发帖数: 71
23
请教一个《Carpenter's Complete Guide to the SAS Macro》上SAS macro的例子。
Chapter 6, Page 111 有一个根据data A1 里两个变量 station 和 depth 生成 一系
列ACSII文件的macro的例子;
**********************;
***6.2.1d
***%DOIT
**********************;
* 1993 Water quality data.
*************************************************;
data a1
(keep=datetime station depth temp ph do cond salinity);
input datetime datetime13. @15 station $3.
depth temp ph do cond salinity;
label datetime = 'date and time of sample collection'
st... 阅读全帖
s********1
发帖数: 54
24
______________________________________________
I got the following error message:
______________________________________________
ERROR: Insufficient authorization to access C:\Program Files\SASHome\
SASFoundation\9.3\TS30.dat
______________________________________________
My code is as follows:
______________________________________________
**********************;
***6.2.1d
***%DOIT
**********************;
* 1993 Water quality data.
*************************************************;
data a1
... 阅读全帖
s****m
发帖数: 57
25
来自主题: Statistics版 - 问几题sas adv, 多谢了!
2. call symput/symputx只有在local table存在时才创建local variable.否则创建
global variable. 换句话说,symput/symputx本身不创建local table,这是跟其
它定义local variable的方式不同的。怎样判断local table是否存在?也就是当前的
macro definition中是否定义了local variable(用symput/symputx方式定义的不算)。
不难发现one和two里面都没有定义local variable,因此不存在local table,所以
symput/symputx只能把新建的date写入global table。又由于调用macro在let之后,所
以覆盖let定义的date的值,故选A.
l**********9
发帖数: 148
26
来自主题: Statistics版 - 一道ADV 130 题目
我想online TUTOR的意思只是说在代码仅被编译未被执行时,symput初始化的变量时
local的,举例说明,如果这道题的代码变成:
%macro one;
data _null_;
call symput('proc','means');
run;
%mend;
proc &proc data=sashelp.class;
run;
则程序出错,因为call symput('proc','means');语句仅仅被编译,没有被执行,所以
他还是局部变量,只能被%macro里面的语句调用。但是如果代码改成:
%macro one;
data _null_;
call symput('proc','means');
run;
%mend;
%one();
proc &proc data=sashelp.class;
run;
则输出结果和原始代码一样。说到底,macro就是让系统执行一段事先设置好的代码,
和直接在macro外部定义全局变量没有区别,只是简化了操作而已。
a****a
发帖数: 3411
27
来自主题: Statistics版 - 请教一个macro的问题
新手问一个宏的问题
我想根据continuous variable的percentile value做一个categorical variable,比
方说有100个categories的categorical variable。
如果分组很多,输入不方便,修改一次变量名累也累死。
如何修改下面这个宏,能够实现划分任意多的category?
多谢 (包子不多2个)
%macro quint(dsn,var,quintvar);
proc univariate noprint data=&dsn;
var &var;
output out=quintile pctlpts=25,50,75,100 pctlpre=pct;
run;
data _null_;
set quintile;
call symput('q1',pct25) ;
call symput('q2',pct50) ;
call symput('q3',pct75) ;
call symput('q4',pct100) ;
run;
data &dsn;
set &dsn;
if &var =. ... 阅读全帖
j******o
发帖数: 127
28
来自主题: Statistics版 - How to import several excel files together?
昨天刚写了几段code,不过是对csv的,请你改一下用在Excel文件上吧。中间有些地方
可能不太完善(比如文件名不能有空格等),欢迎改进及简化。
----------------------------------------------------------------
libname backup "C:\Documents and Settings\Ying\Desktop\Test";
filename blah pipe 'dir "C:\Documents and Settings\Ying\Desktop\Test\*.csv"
';
data dirlist;
infile blah truncover lrecl=200;
input line $200. ;
if upcase(substr(line, 1, 9))='DIRECTORY' then call symput('direc', trim
(substr(line, 14, length(line))));
if input(substr(line,1,10), ??... 阅读全帖
a********g
发帖数: 651
29
来自主题: Statistics版 - SAS ADV passed!!!
昨天终于考完ADV了,前后复习了1个多月,从本版得到了很大的帮助。前面的几个总结
性的帖子很管用,特别是pricematch 的帖子提到的,我基本上都考到了。
下面具体的说说我考的题目。
SQL:
各种的join都有涉及,和merge,set a, set b 的情况比较。
SQL insert 的格式
IC的使用
SQL中index 和view的基本用法。
Dictionary.table
MACRO:
很多%在一起的结果,有2题
Automacro 中sysday and sysdate的区别
特别要注意的一个考点,这个是我没有在online tutor 中见到的:
Call symput 的用法,其输出什么情况下在local,什么情况在global。
Symput and symputx 的区别,这个自己瞎蒙的。
%let在什么地方,是否影响symput
Efficient:
前人已经说得很全面了,我只想补充几点。
Transpose 的用法
By groupformat
By x notsorted
Array的基本用法
If and select比较
hash object
s****m
发帖数: 57
30
来自主题: Statistics版 - 问几题sas adv, 多谢了!
symput是在two中创建新变量的,不是在one中。每个macro program都有自己的local
table,不是共享的。two没有local table,所以不行。我没有听说过symput会搜索
closest nonempty table,建议你再查一下。我的理解是,对于嵌套的macro,虽然内
层的macro可以调用外层macro的local table中的变量,但这跟symput在创建变量时判
断当前的macro是否有local table没关系。
l***a
发帖数: 12410
31
another one
proc contents data=one out=one_var (keep=name varnum where=(name~='id')) nop
rint;
run;
proc sort data=one_var;
by varnum;
run;
data _null_;
set one_var end=last;
length allvar $100.;
format allvar $100.;
retain allvar;
if _n_=1 then allvar='';
count+1;
call symput(compress('var'||count),compress(name));
allvar=compbl(allvar||name||' ');
if last then do;
call symput('allvar',compbl(allvar));
call symput ('var_ct',count);
end;
run;
%put &var_ct &var1 &var2 &var
N********a
发帖数: 248
32
来自主题: Statistics版 - 一个不理解的SAS program
大家帮我看看,我对于这个的processing不太理解
data seeds;
input seed;
call symput('seed'!!trim(left(put(_n_,3.0))),trim(left(put(seed,12.0))));
call symput('nseed',trim(left(put(_n_,3.0))));
cards;
12345
14159
97531
13579
;
run;
%put nseed=&nseed seed1=&seed1 seed&nseed=&&seed&nseed;
我觉得log 应该是nseed=4 seed1=12345 seed4=13579,不知道对不对
我还没run这个program,因为是一个大的program的一部分。我不太理解的地方就是,
sas online tutor上说call symput是在data step execute之后才assign value的,而
等到data step 开始execute之后_n_不就没了么?怎么还能赋予macro variable值呢?
拜谢拜谢
b**********i
发帖数: 1059
33
来自主题: Statistics版 - SAS ADVANCED 一道题求助
CALL SYMPUT may not create a GLOBAL macro variable when defined inside a
macro definition. When we use
CALL SYMPUT inside a macro definition, it will write the macro variable
values into a local symbol table, if the
macro has a non empty local symbol table. If macro has an empty local symbol
table, the macro variable defined
inside a macro, using CALL SYMPUT routine has global scope. The rules do not
apply when you explicitly define
them as GLOBAL or LOCAL.
t*****8
发帖数: 157
34
来自主题: Statistics版 - 问大家一个Macro的问题
i 不需要定义。这是Carpenter__s_Complete_Guide_to_SAS_Macro的一个程序在131页。
**********************;
***6.5.3c
***
**********************;
proc summary data=sasclass.clinics noprint nway;
class clinname;
var dob;
output out=cnt n=count;
run;
data _null_;
set cnt;
i+1;
ii=left(put(i,best12.));
call symput('name'||ii,clinname);
call symput('cnt'||ii,left(put(_freq_,best12.)));
call symput('namecnt',ii);
run;
w*****1
发帖数: 473
35
来自主题: Statistics版 - a question about SAS
Thank you very much for your help!
我改了CODE如下: 现在已运行了1小时还没有停止,大家能否帮我看看? 谢谢!
data parents; set csgl.individs;
keep i QTP pedid dgeno;
if i <=2;
run;
option symbolgen mprint mlogic;
%macro new(mudaa=, mudab=, mudbb=, de=, dq=, indata=, outdata=);
data &outdata; set &indata;
lnl=log(((1-&dq)**2)*(1/sqrt(2*constant('PI'))*&de)*exp(-0.5*(((QTP-&mudaa)/
&de)**2))+
2*&dq*(1-&dq)*(1/sqrt(2*constant('PI'))*&de)*exp(-0.5*(((QTP-&mudaa)/
&de)**2))+
(&dq**2)*(1/sqrt(2*constant('PI'))*&de)*... 阅读全帖
n*****t
发帖数: 1015
36
比如第一个loop里yr=2005, mon=1,我在log file里得到这样的error message:
ERROR: Physical file does not exist, E:vrpdata_analysishighfreq_datastk_list_
2004.txt.
ERROR: Import unsuccessful. See SAS Log for details.
ERROR: File ORIG.MT_.DATA does not exist.
ERROR: File WORK.YR_1.DATA does not exist.
我的程序如下:谢谢!
%macro subsetall;
%do yr=2005 %to 2006;
data _null_;
if &yr<=2005 then idxm=12;
else idxm=6;
call symput('idxm',idxm);
run;

%put &idxm;
%do mon=1 %to &idxm;
... 阅读全帖
p***h
发帖数: 1462
37
来自主题: Database版 - Help! A SAS/Macro question. Thanks!
Please simplify the following program by macro statement. Thanks.
%let gennum12=378;
%let gendte12="06jul2001"d;
*******
*******;
data _null_;
x=mdy(month(&gendte12-28),01,year(&gendte12-28));
y=x+
mod(((6-weekday(x))>=0)*(6-weekday(x))+((6-weekday(x))<0)*(7+6-weekday(x)),7);
call symput('gennum11',put(&gennum12-(&gendte12-y)/7,z3.));
call symput('gendte11','"'!!put(y,date9.)!!'"d');
run;
da
n*****s
发帖数: 10232
38
来自主题: Statistics版 - 靠,这个哪错了?
%let date=31oct2007;
%put &date;
data _null_;
do i=0 to 6;
call symput('mon_'||left(put(i,8.)),put(intnx('month',"&date"d,i,'end'),
date9.));
end;
run;
%put &mon_0 &mon_6;
%macro mm;
%do i=0 %to 6;
data _null_;
call symput("mm_&i",substr(put("&&mon_&i"d,ddmmyy6.),3,4));
run;
%end;
%mend mm;
%mm;
%put &mm_0 &mm_6;
后面那个macro总解不出来... 部分log:
MLOGIC(MM): %DO loop index variable I is now 6; loop will iterate again.
MPRINT(MM): data _null_;
SYMBOLGEN: Macro variable I resol
f*****a
发帖数: 693
39
来自主题: Statistics版 - sas advance problem
Given data one,
Division sales
A 1234
A 3654
B 5678
The following SAS program is submitted:
data _null_;
set one;
by division;
if first.division then
call symput('mfirst',sales);
if last.division then
call symput('mlast',sales);
run;
which one of the following is the value of the macro variable mfirst when
the above program finish execution?
A. null B. 1234 C. 3654 D. 5678
Answer: D
Why not B. thanks.
s*********h
发帖数: 16
40
来自主题: Statistics版 - 请教一道SAS题
Given the following SAS data set ONE:
ONE
DIVISION SALES
A 1234
A 3456
B 5678
The following SAS program is submitted:
data _null_;
set one;
by division;
if first.division then call symput(’mfirst’,sales);
if last.division then call symput(’mlast’,sales);
run;
Which one of the following is the value of the macro variable MFIRST when
the above program finishes execution?
(A) null
(B) 1234
(C) 3456
(D) 5678
答案为什么是D呢?谢谢
w********e
发帖数: 944
41
来自主题: Statistics版 - 请帮忙看3道SAS题。
1) D
只有在已经存在local symbol table的前提下,SYMPUT才产生local macro;否则,SYMPUT
产生的macro var在global symbol table中.
2)A
%letcompile时生成macro变量. data step执行时的logic是
if totalobs > 10 then do;
end;
else do;
end;
A*******s
发帖数: 3942
42
来自主题: Statistics版 - killtest Q78 79 80
78. Positional parameters have to be listed before keyword parameters.
79. Call Symput routine is the only way to pass a value to a macor variable
within data step in execution time. Besides, %let total=counter; or %global
total=counter; can't even retrieve the value from data-step variable. Both
can only assign the text 'counter' to macro variable total;
80.%let statement is executed before data step is executed.(Again, Call
Symput routine is the only way to pass a value to a macor variable wit
v*******g
发帖数: 334
43
来自主题: Statistics版 - 请教 如何用macro variabe 传递数值?
But this macro variables do not work either
data aaa;
set aaa;
age1=compress("weigh"||start);
age2=compress("weigh"||end);
call symput('age_start',age1);
call symput('age_end',age2);
age_start= &age_start;
age_end= &age_end;
run;
f*******e
发帖数: 51
44
try this:
data countmiss;
input var1 var2 var3 var4 var5 var6;
cards;
0 0 0 0 0 1.2
0 0 0 0 5.8 4.7
58.8 0 0 30 0 33.3
100 0 0 100 0 66.6
;
run;
data _null_;
set countmiss;
array var(*) var1-var6;
call symput("list"||strip(_N_),"");
do i=1 to dim(var);
if var(i)>0 and var(i) <50 then do;
call symput("list"||strip(_N_),symget("list"||strip(_N_))||" "||"var"||strip
(i));
end;
end;
run;
%put &list1 &list2 &list3 &list4;
z****n
发帖数: 67
45
多谢楼上提醒,把楼上的code改成下面的就可以运行啦!
data countmiss;
input var1 var2 var3 var4 var5 var6;
cards;
0 0 0 0 0 1.2
0 0 0 0 5.8 4.7
58.8 0 0 30 0 33.3
100 0 0 100 0 66.6
;
run;
data _null_;
set countmiss;
array v(*) var1-var6;
call symput("list"||compress(_N_),"");
do i=1 to dim(v);
if 0< v(i) <50 then do;
call
symput("list"||compress(_N_),left(trim(symget("list"||compress(_N_))||"
"||"
var"||compress(i))));
end;
end;
run;
%put list1=&list1 ;
%put list2=&list2 ;
%put list3=&list3 ;
%put list4=&lis
h****o
发帖数: 119
46
来自主题: Statistics版 - 一道ADV 130 题目
SAS ADV 130的第81题:
%macro one;
data _null_;
call symput('proc','means');
run;
proc &proc data=sashelp.class;
run;
%mend;
%one()
What is the result?
A. The macro variable PROC is stored in the local symbol table.
B. The macro variable PROC is stored in the global symbol table.
C. The macro variable PROC is stored in the SAS catalog WORK.SASMACR.
D. The program fails to execute because PROC is a reserved word.
被GLOBAL和LOCAL SYMBOL TABLE弄晕了.为什么答案是B而不是A呀?
CALL SYMPUT不是用在MACRO DEFINITION中吗?那么,所生成的MACR... 阅读全帖
m****r
发帖数: 202
47
来自主题: Statistics版 - 请问SAS advanced macro global 和local
%macro place;
data _null_;
call symput('dept','sales');
run;
%let country=Germany;
%put _user_;
%mend;
%let company=ABC;
%place
请问为什么log中
GLOBAL DEPT sales ???
GLOBAL COMPANY ABC
a DATA step that contains a SYMPUT routine within a macro definition suppose
to create local macro variables
谢谢答复
m****r
发帖数: 202
48
来自主题: Statistics版 - 请问SAS advanced macro global 和local
Online Tutor
You can create a global macro variable with
* a %LET statement (used outside a macro definition)
* a DATA step that contains a SYMPUT routine
* a SELECT statement that contains an INTO clause in PROC SQL
* a %GLOBAL statement.
http://www.target-touch.com/admin/Ke8s3laOdN/60477/m52/m52_27.htm
You can create local macro variables with
* parameters in a macro definition
* a %LET statement within a macro definition
* a DATA step that contains a SYMPUT routine... 阅读全帖
m****r
发帖数: 202
49
来自主题: Statistics版 - 请问SAS advanced macro global 和local
data _null_;
call symput('dept','sales');
run;
我觉得这就是在data step里定义了一个 symput routine,
我的理解错误?
r******m
发帖数: 369
50
来自主题: Statistics版 - SAS ADVANCED 一道题求助
查了manual,这道题得情况属于a data step that contains a symput把?
You can create local macro variables with parameters in a macro definition
a %LET statement within a macro definition
a DATA step that contains a SYMPUT routine within a macro definition
a SELECT statement that contains an INTO clause in PROC SQL within a macro
definition
a %LOCAL statement.
1 2 3 下页 末页 (共3页)