由买买提看人间百态

topics

全部话题 - 话题: symbolgen
1 (共1页)
k*****n
发帖数: 361
1
来自主题: Statistics版 - 为啥我的宏不被解释--SYMBOLGEN
都写了
options symbolgen;
然后用带参数的宏
%macro ICD9_Charl(LIB,CLMIN,CLMOUT);
%let DC1=%str('410','412');
.....
同一段SAS在同事的机器上就能运行而我的不行,都是用的一个平台SAS enterprise 5.
1,难道我的SAS里面哪里没设置对不能解释这个宏?
错误语句是:
%macro ICD9_Charl(LIB,CLMIN,CLMOUT) is not in a proper order.
但是在他那里就有这个:
SYMBOLGEN: Macro variable LIB resolves to work
l**********8
发帖数: 305
2
来自主题: Statistics版 - SAS macro Debug

************************************************************
上个完整的LOG, 谢谢大家了
****************************************************************
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds

25
26 *-----------------------------------------------------;
27 %macro process(year,yr,file,first,numobs);
28
29 data cartemp;
30 set loc.carl&year.
31 (firsto... 阅读全帖
P****D
发帖数: 11146
3
来自主题: Statistics版 - 问个sas adv的问题
你自己看log不就都解决了么?总之就是碰见两个&的时候自动变成一个。
441 %let test = one;
442 %let one = two;
443 %let two = three;
444 %let three = last;
445 %put what displays is &test;
SYMBOLGEN: Macro variable TEST resolves to one
what displays is one
446 %put what displays is &&test;
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable TEST resolves to one
what displays is one
447 %put what displays is &&&test;
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable TEST resolves to one
SYMBOLGEN: Macro variab... 阅读全帖
w****g
发帖数: 81
4
来自主题: Statistics版 - 大家说说这是电脑的错还是SAS的错
我好像是没错的
SYMBOLGEN: Macro variable SUM_CURRENT_GRP resolves to 5.73
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable I resolves to 9
SYMBOLGEN: Macro variable GRP9 resolves to 42.489
MLOGIC(GRP): %IF condition &sum_current_grp. < &&grp&i. is FALSE **wrong
SYMBOLGEN: Macro variable SUM_CURRENT_GRP resolves to 1.35
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable I resolves to 10
SYMBOLGEN: Macro variable GRP10 resolves to 8.073
MLOGIC(GRP): %IF condition &sum_current_... 阅读全帖
l**********8
发帖数: 305
5
来自主题: Statistics版 - SAS macro Debug
就是debug不出来,大神们救我啊
******************* 完整的 CODE ***************
%let dataloc = /disk/agedisk1/medicare/data/20pct/car;
libname bworkhos "/disk/agebulk5/medicare.work/lbaker-DUA23466/ausmita/temp"
;
*libname temp "/disk/agebulk5/medicare.work/lbaker-DUA23466/lbaker/data/xw";
ods listing file = "/disk/agebulk5/medicare.work/lbaker-DUA23466/ausmita/
temp/carrier_12222015.lst";
proc printto
log="/disk/agebulk5/medicare.work/lbaker-DUA23466/ausmita/temp/carrier_
12222015.log";
run;
*--------------... 阅读全帖
l**********8
发帖数: 305
6
来自主题: Statistics版 - SAS macro Debug
就是debug不出来,大神们救我啊
******************* 完整的 CODE ***************
%let dataloc = /disk/agedisk1/medicare/data/20pct/car;
libname bworkhos "/disk/agebulk5/medicare.work/lbaker-DUA23466/ausmita/temp"
;
*libname temp "/disk/agebulk5/medicare.work/lbaker-DUA23466/lbaker/data/xw";
ods listing file = "/disk/agebulk5/medicare.work/lbaker-DUA23466/ausmita/
temp/carrier_12222015.lst";
proc printto
log="/disk/agebulk5/medicare.work/lbaker-DUA23466/ausmita/temp/carrier_
12222015.log";
run;
*--------------... 阅读全帖
P*****i
发帖数: 63
7
来自主题: Statistics版 - 与Macro相关的字符函数
嗯,是哒,我就是在机器上跑过了还是不懂。
SAS运行结果如下:
199 options symbolgen;
200 %let a=begin;
201 %let b=%nrstr(&a);
202 %put UPCASE produces: %upcase(&b);
SYMBOLGEN: Macro variable B resolves to &a
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been
unquoted for printing.
SYMBOLGEN: Macro variable A resolves to begin
UPCASE produces: begin
~~~~~~~~~~~~~~~~~~~~~~~
这里为什么UPCASE不进一步执行替换大写的操作?
203 %put QUPCASE produces: %qupcase(&b);
SYMBOLGEN: Macro variable ... 阅读全帖
s*********h
发帖数: 6288
8
来自主题: Statistics版 - Help: SAS code
/*==============*/
%macro trans(date=);
%let mth = %sysfunc(month(&date)));
%let yr = %sysfunc(year(&date)));
%put &mth &yr;
%if &mth eq 1 %then %do;
%let preyr = %eval(&yr - 1);
%let premth = 12;
%end;
%else %do;
%let preyr = %eval(&yr);
%let premth = %eval(&mth - 1);
%end;
%end macro;
/*===========*/
%trans(date='01sep2013'd)
/*===Log====*/
24 %trans(date='01sep2013'd)
MLOGIC(TRANS): Beginning execution.
MLOGIC(TRANS): Parameter DATE has value '01sep2013'd
MLOGIC(... 阅读全帖
t**i
发帖数: 688
9
来自主题: Statistics版 - SAS macro variable resolution question
49 data a;
50 set b;
51 do I = 1 to 3;
SYMBOLGEN: && resolves to &.
WARNING: Apparent symbolic reference I not resolved.
SYMBOLGEN: Unable to resolve the macro variable reference &i
SYMBOLGEN: Macro variable FRUIT resolves to good
SYMBOLGEN: Unable to resolve the macro variable reference &i
52 keep &&fruit&i ;
NOTE: Line generated by the macro variable "I".
52 good&
-
22
200
WARNING: Apparent symbolic reference I not resolved.
ERROR 22
d******9
发帖数: 404
10
来自主题: Statistics版 - sas question!!!
Or use macro to do it. Below codes works well, tested with few sample
datasets.
options mprint symbolgen;
data A_201201;
A=225;
run;
data A_201207;
A=226;
run;
data A_201205;
A=338;
run;
data R_201207;
A=338;
run;
data B_201279;
A=551;
run;
proc sql;
select memname into : tables separated by ' '
from sashelp.vtable
where libname='WORK' and upcase(substr(memname, 1,1))='A';
quit;
data combine;
set &tables;
run;
=============================
LOG:

45 data combine;
SYMBOLGEN: Macro ... 阅读全帖
n********6
发帖数: 1511
11
来自主题: Database版 - SAS Macro Interesting Question
%MACRO FirstCharFreq;
%DO j = 1 %to 4;
%IF &j = 1 %THEN %DO;
%put j;
run;
%END;

%IF &j >=2 %THEN %DO;
%put j;
run;
%END;

%END;
%MEND FirstCharFreq;
Log:
MLOGIC(FIRSTCHARFREQ): %DO loop beginning; index variable J; start value is
1; stop value is 4; by
value is 1.
MLOGIC(FIRSTCHARFREQ): %IF condition j = 1 is FALSE
MLOGIC(FIRSTCHARFREQ): %IF condition j >= 2 is TRUE
MPRINT(FIRSTCHARFREQ): proc freq data = single1 ;
SYMBOLGEN:
n*****s
发帖数: 10232
12
来自主题: 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
s********l
发帖数: 245
13
来自主题: Statistics版 - 求助关于sas macro 中的if- then语句
Here is the code:
option symbolgen mprint mlogic;
%macro parametric(original=, dsn=, marker1=, marker3=, upper=, lower=,
constant=);
data &dsn;
set &original;
%let constrain1 =%sysevalf(abs(%str(&marker1 - &constant)));
%let constrain2 =%sysevalf(abs(%str(&marker3 - &constant)));
%if &marker1 NE &constant and &marker3 NE &constant %then %do;
&upper=abs(&marker1-&marker3);
&lower=abs(&marker1-&marker3);
%end;
%if &marker1 NE &constant
A*********u
发帖数: 8976
14
options mprint mlogic symbolgen;
you can also use
%put phat=&phat;
to check the value of macro varialbe at any place

编了一段很长的macro来实现某个复杂模型下的EM algorithm,里面有3个macro
variable分别是&phat, &muhat, &sigma
我设定程序循环10次,所以应该产生10组phat, muhat,sigma
可是我不知道怎么把这10组phat, muhat,sigma在每一次循环的结尾打印出来,或者最
后产生一张表打印出所有10组phat, muhat,sigma。有高手知道怎么写SAS code么?不
胜感激。。
d*******1
发帖数: 854
15
什么叫一步一步的结果? 你不可以打开中间产生的dataset看看吗?
可以加上options merror mprint mlogic symbolgen试试.
或者你可以用这样的方式先run前10行macro code, 得到结果, 再run前11行, 再看结果
,这样就可以一行一行检查了.
t**i
发帖数: 688
16
来自主题: Statistics版 - SAS macro variable resolution question
options symbolgen mprint mlogic ;
Data b;
Input ID apple orange banana papaya ;
Datalines;
1 1 2 3 4
2 5 6 7 8
;
Run;
%let fruit = good ;
%let fruit1 = apple ;
%let fruit2 = orange ;
%let fruit3 = banana ;
data a;
set b;
do I = 1 to 3;
keep &&fruit&i ;
end;
run;
g********d
发帖数: 2022
17
来自主题: Statistics版 - 问几道SAS Adv的题
6: B
Inner query produce less obs than outer. Conflict results.
11: A
To create a data step view, the two names need to be the same. If not, a
dataset with the first name will be created.
26: C
There are two names before /
50: B
Need a "calculated" before "overall".
54: B
Use "OPTION SYMBOLGEN;" to see the process yourself.
x*********0
发帖数: 651
18
来自主题: Statistics版 - 刚考完sas advance
题目基本上和12月份一样。有几道不一样的。
有一道是关于mlogic,mprint和symbolgen。最好把这几个概念弄清楚。
还有一题有点长,是关于有index情况下执行proc print 命令的,此时能不能产生报告
g********d
发帖数: 2022
19
来自主题: Statistics版 - 土问,R SAS是不是是都不能debug?
SAS 里面data step可以用
data xxx/debug;
要看macro执行可以用symbolgen等等。
e*******7
发帖数: 446
20
我来汇报一下 12月9号考的 题库没怎么变 但是有一两道好像不是63题里的 变的那
道是关于 mprint, mlogic, symbolgen 的 其它都没变 基本上看真题就能90%
a*****3
发帖数: 601
21
来自主题: Statistics版 - 请教一个sas macro的问题
话说没人喜欢看别人code where there are even typos not cleared (maxbos?). The
%if %then is also used in a weird fashion. Your code worked okay after i
deleting everything i did not understan:
%macro sumv(maxobs=);
%do i=1 %to &maxobs;
sum&i+summer&i ;
%end;
%mend sumv;
option mlogic mprint symbolGEN;
data sum_data;
set wide end=lastobs;
%sumv(maxobs=4) ;
keep sum1-sum4;
if lastobs then output;
run;
杀牛给点伪币吧 马上到年关了
m****r
发帖数: 202
22
来自主题: Statistics版 - [sas] how to recode these variables
this file has 20 data sets, and every data set has 200-5000 observations, so
I write the following according to honglajiao's help
%macro recode(dr=,category=,amount=,else=);
proc sql noprint;
create table &dr as
select &dr
from .....;
quit;
data new;
set &dr;
if scan(&dr,2," ")="&category" then &dr._re=1*substr(&dr,1,2);
else if scan(&dr,2," ")="&amount" then &dr._re=6*substr(&dr,1,2);
else if &dr="1/2" then &dr._re=0.5;
else &dr._re=1*substr(&dr,1,2);
run;
proc print;run;... 阅读全帖
n**m
发帖数: 156
23
来自主题: Statistics版 - 问个sas adv的问题
我明白了,多谢,没养成用symbolgen的习惯。
w*****1
发帖数: 473
24
来自主题: 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)*... 阅读全帖
b**********9
发帖数: 8
25
来自主题: Statistics版 - 请问个macro问题
%let a= %str( b, c, d, e, f);
%let b= %str( b c d e f);
options mprint symbolgen;
data x;
b=2 ; c=3 ; d=4; e=5; f=6;
z=mean (of _numeric_);
y=mean (of &b);
x=mean(&a.);
run;
只要稍微修饰 加上个of,偶以为 你的方法就可以很好的使用 不妨一试
见笑
D******n
发帖数: 2836
26
Let me share with you some tricks or techniques i use to debug or facilitate
debugging SAS codes in Linux environment.
> proc print with obs= option. (ya very simple very naive)
> endsas statement.
> /* */ to comment out codes.
> sas -obs ### xxxx.sas (SAS options need not to be hard written in the
script, you can call it when batch running it)
> use put in data step to monitor SAS variable.
> use mprint, mlogic, symbolgen, source, source2 to debug macros.
> use %put to monitor macro variable.
>... 阅读全帖
k*****u
发帖数: 1688
27
dont forget to check ERROR WARNING in the log file.
send out output to email.
merge/inner join/ left join/ right join, don't forget to check if they are
correct. check if the key variable should be unique or not.
Join a small table with a large table, index them .
join a large table with a large table(I once did a 3M table left join
1billion table), proc sql left join takes more than 3 days and not finished.
Then I tried split the 2M table to a small table with 5k obs each, then use
macro and lo... 阅读全帖
k*******a
发帖数: 772
28
来自主题: Statistics版 - Need advice on SAS macro debugging
To debug SAS MACRo program, you can run program step by step
Use %let to assign some value for each parameter, then proceed
Check log to see which step has problem
options like mprint symbolgen may be helpful
z**********i
发帖数: 12276
29
来自主题: Statistics版 - 为啥我的宏不被解释--SYMBOLGEN
library的问题?

5.
d*********d
发帖数: 239
30
编了个MACRO程序想把 一个字符串 q1 q2 q5-q8 变成 q1#q2#q5-q8
原始程序如下
OPTIONS MPRINT;
OPTIONS SYMBOLGEN;
%MACRO convert(pound);
%DO i = 1 %TO %SYSFUNC(COUNTW(£,%STR( )));
%IF &i = 1 %THEN %LET list = %QSYSFUNC(SCAN(£,&i,%STR( )));
%ELSE %LET list = &list%STR(#)%QSYSFUNC(SCAN(£,&i,%STR( )));
%END;
%MEND convert;
%PUT %convert(q1 q2 q5-q8);
不给最终结果。mprint显示到q1#q2生成了,但不生成最后结果。程序也没出错。
当我把%DO循环改成
%DO i = 1 %TO %EVAL(%SYSFUNC(COUNTW(£,%STR( )))+1);
维持其他不变,就可以得到最终结果。
虽然得到了最终结果,但不明白为什么循环部分要加1.COUNTW结果... 阅读全帖
m******r
发帖数: 1033
31
来自主题: Statistics版 - 与Macro相关的字符函数
这东西吧 确实烦人。 可也没什么大不了的。 无非就是上机自己试一试罢了,对着结
果怎么都能解释得通。 你也可以开那三个常用的option. 什么mprint symbolgen之类
,对着log一点点抠。 这就是sas的牛逼之处, 大不了对着log死磕,所有的问题都能
解决。 就凭这一点,一年给sas交一万块钱, 值。
1 (共1页)