由买买提看人间百态

topics

全部话题 - 话题: macro
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
l*********t
发帖数: 18
1
来自主题: Statistics版 - 问一个SAS macro的问题
sas是可以这样返回值的, 不过我承认的确很不方便.
如果不这样返回的话, 就只能用global variable. 我个人不喜欢用太多global macro
variable. 用多了程序结构很乱.
其实sas的macro做得就跟一坨屎一样, 我经常想写信骂他们.
z**********i
发帖数: 12276
2
来自主题: Statistics版 - 请问什么是SAS internal macro
是说,小的MACRO可以建个FOLDER,大的MACRO套着这些小的用吗?
A****t
发帖数: 141
3
来自主题: Statistics版 - 【包子】求问个简单sas macro问题
把data step variable的值赋给macro variable,要用symput不能用%let,因为在data
step编译之前,macro语句就已经被执行了,所以你的%eval(x)里面,x就只是一个
character x
把%let那一行改成call symput('x',trim(left(x))); 应该就可以了
v***a
发帖数: 701
4
来自主题: Statistics版 - 请问个macro问题
%let a = b c d e f...之后,怎么用macro求b c d e f...的mean?
写mean(&a)不对,是否要写一个macro function?
包子感谢
h******e
发帖数: 1791
5
来自主题: Statistics版 - help. sas macro
其一,你在macro里引用的不是macro parameter。其二,character的值应该加引号。
g**u
发帖数: 205
6
原来如此。
因为% macro animal时没有提到define animal(a),所以a是独立的macro variable。
g**u
发帖数: 205
7
来自主题: Statistics版 - 问一个macro编程问题
有这么一段data
data clinic;
input symptom patient_weight treatment day;
cards;
cough 100 1 5
cough 120 2 10
cough 290 3 15
heat 89 1 5
heat 111 2 10
heat 124 3 15
;
我用proc freq来summarize symptom
proc freq;
by symptom;
table treatment*day;
weight patient_weight;
run;
怎么用macro来写呢?
%macro symptom(treatment,day,patient_weight);
proc freq;
by &symptom;
table &treatment*&day;
weight &patient_weight;
run;
%mend;
这样对吗?
g****8
发帖数: 2828
8
来自主题: Statistics版 - 问一个macro编程问题
没有明白,你的macro需要干什么?
如果只是那个freq的话,不需要macro吧,没有什么东西是变化的呀。
l*******a
发帖数: 107
9
来自主题: Statistics版 - macro问题诚心求教非常感谢
我写了一个小macro, 程序是这样的:
%macro gg(name, length, price);
%put if &name.length=&length then &name.price=&price;
%mend;
data one;
input variableName $14. variableLength : $12. price;
datalines;
FundingAmount 0-15000 0.217
ObjectAmount 15000-30000 0.318
FundingAmount 30000-60000 0.519
;
run;
data two;
set one;
put 'this is the data';
put 'Please read this in details';
call execute('%gg('||variableName||', '||variableLength||', '||price||')');
run;
我想要的结果是:
this is the data
Please... 阅读全帖
x**********0
发帖数: 163
10
来自主题: Statistics版 - SAS macro to import multiple csv file??
I want to import multiple csv file
acc1990
acc1991
..
acc2010
I write a SAS macro like this
%MACRO importAcc (first=1990, last=2010);
%local year;
%do year=&first %to &last;
proc import datafile="C:\Users\acc&year..csv"
out=acc&year
dbms=csv
replace;
getnames=yes;
run;
%end;
%MEND importAcc;
%importAcc
But it is wrong and give back nothing, Can anybody help me with this? Thanks
f******u
发帖数: 250
11
来自主题: Statistics版 - SAS macro to import multiple csv file??
当你run macro时,你没有赋值给macro, should be:
%importAcc(first=1990, last=2010)
l*****8
发帖数: 483
12
来自主题: Statistics版 - sas macro 问题请教。。
我有一个macro test, 一个dataset, 变量为V1, 如下。
我想在读每行数据的时候, V1里面的值(4,6,7)可以在%test(count) 里得到。 如果用
&test(v1), 那macro里 count的值只是 ‘V1’, 而不是 4。 请问如何能把4 放进去。
非常感谢。
%marcro test(count);
.....
%mend;
v1
4
6
7
l*****8
发帖数: 483
13
来自主题: Statistics版 - sas macro 问题请教。。
对不起各位, 我没解释清楚, 下面是个例子, 如果读第一个数据4, macro要重复写
4 遍 put '123', 然后读6,重复写6遍 put '123'. 以此类推。。。
谢谢。
%macro test(count);
%do i=1 %to &count;
put '123';
%end;
%mend;
data aaa;
input v1;
cards;
4
6
7
;
data bbb;
set aaa;
%test(v1);
run;
s********1
发帖数: 54
14
______________________________________________
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
... 阅读全帖
d******9
发帖数: 404
15
来自主题: Statistics版 - SAS MACRO question (包子求教重金酬谢)
I know what you mean. We can use the wild card and data step to do it.
But it may have some limitations.
My macro can read in ANY kinds of external files stored in a directory, it
is a general and useful macro.
t*********l
发帖数: 778
16
来自主题: Statistics版 - 请教一个SAS macro variable 问题
我正在写一个macro,
macro a (dataset=,
CAT**=,
CAT**=,
..
CAT**=,
DOG**=,
DOG**=,
...DOG**=);
有两组input ,first one starts with CAT , anther one starts with DOG.
我想加 CAT组和DOG组, 但是不想列举,因为太多。
请问有什么好办法吗?
感谢
k**k
发帖数: 61
17
来自主题: Statistics版 - Need advice on SAS macro debugging
Thanks for your advice. I would do the same as well if I were to build the
codes myself from scratch. But to review someone else's codes with little
background, I pretty much have to guess what is going on inside the macro.
Having a way to step through line by line while observing the values of
macro variables will be extremely helpful in this case. Yet not sure if this
is something available in SAS...
j**********3
发帖数: 305
18
来自主题: Statistics版 - Need advice on SAS macro debugging
using option mlogic mprint on the top of Macros
eg:
option mlogic mprint;
%macro aa();
%mend;
s******3
发帖数: 57
19
1) %let a=cat;
%macro animal;
%let a=dog;
%mend;
%animal;
%put a is &a;
answer: a is dog
2) %let a=cat;
%macro animal(a=pig);
%let a=dog;
%mend;
%animal;
%put a is &a;
answer: a is cat
1)似乎比较容易理解, 可2) 是为什么??
s*****a
发帖数: 2735
20
来自主题: Statistics版 - 有关sas macro 的问题
试试把lifetest放到macro里?
%macro test1;
proc lifetest XXX;
strata &trt / order=internal;
....;
run;
%mend test1;
%test1;
看看这样行不行?
--------------------
不知道你的&trt是怎么来的,能把&trt产生那一步也给出吗?
s******8
发帖数: 102
21
来自主题: Statistics版 - 有关sas macro 的问题
不清楚究竟是啥问题。“问题是&trt是macro variable, 我不知道如何用format 和
informat.”
是否可以照猫画虎?
%macro test1;
data xxx;
format &trt yourmatnamehere.;
set xxx;
run;
proc lifetest XXX;
strata &trt / order=internal;
....;
run;
%mend test1;
%test1;
t*********e
发帖数: 313
22
来自主题: Statistics版 - SAS Macro Language 9.3, Free PDF Book
发现这本书写得很通俗易通。在过去几年的工作中,刚觉SAS的客户服务一流!看好它
家的就业市场!
SAS 9.3 Macro Language Reference:
http://support.sas.com/documentation/cdl/en/mcrolref/62978/PDF/
SAS 9.2 Macro Language Reference:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/PDF/
s********e
发帖数: 255
23
来自主题: Statistics版 - SAS macro question
Dear all,
I’m having a problem writing a SAS macro.
Briefly, I would like to store values of a variable from a dataset to a
macro variable, and use those values in the regression model.
For example, the B variable in the following model is a continuous model and
I would like to update the &I in the following model with a series of
values of B, such as 2, 6, 9, 13, etc, one for each time.
PROC RLOGIST DATA=FINAL FILETYPE=SAS;
NEST SDMVSTRA SDMVPSU;
WEIGHT WTDR2D4YR;
CLASS A;
MODEL Y= A... 阅读全帖
x******6
发帖数: 160
24
来自主题: Statistics版 - 怎么解决这个sas macro的问题?
mentor_2_nodup_active 数据库里面有一些mentor的名字 (mentor_name_2),
mentor_one_mentee_active 数据库里面有另外一些mentor的名字 (mentor_name_1),
mentor_name_2里面的一些名字和mentor_name_1里面的名字是一样的,
我想看看哪些mentor的名字两个数据库里面都有,
我用sql create 一个 macro variable,
然后查找,可是最后给我的结果是0,原因是: The quoted string currently being
processed has become more than 262 characters long. You may have unbalanced
quotation marks.
不知道哪位sas高人能给指点一下,怎样解决这个sas macro的问题。
BTW: 我知道可以用 sas data step来merge两个 databases。可是,我不想这样做,
因为还要sort数据,rename variable。
proc sql;... 阅读全帖
s*********h
发帖数: 6288
25
来自主题: Statistics版 - SQL macro variable
求问在SQL中怎么建立和使用macro variable?
类似于SAS中
%let XXXX 之类的东西。
我放狗搜了半天只有介绍macro (function)的。
有什么推荐的书我可以参考一下吗?
s*******e
发帖数: 1385
26
你的文件时存在E盘的?
你的macro里面所有的if then都应该%if %then,因为你判断的是macro variable的值,
不是data variable
g******a
发帖数: 21
27
Sorry, I sent the wrong one.
%macro check;
data a2;
set a1;
%do i=1 %to 10;
if fu_yr=&i. then do;
%do j=1 %to &i.;
n&j.=0;
%end;
end;
%end;
run;
%mend;
Thanks for those who provide help. I need to use macro variable and do loop
because I have much more complicated time-dependent event to consider. Here
is question which can give me the basic structure.
g**********y
发帖数: 1217
28
来自主题: Statistics版 - 招一个macro quant/PM (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: gatsbyreally (gatsby), 信区: JobHunting
标 题: 招一个macro quant/PM (转载)
发信站: BBS 未名空间站 (Thu Mar 27 11:48:51 2014, 美东)
发信人: gatsbyreally (gatsby), 信区: Quant
标 题: 招一个macro quant/PM
发信站: BBS 未名空间站 (Thu Mar 27 11:39:27 2014, 美东)
工作地点在CT 或NYC
基本要求:数学/经济/统计/金融 PhD,2-3年经验
站内联系。
g**********y
发帖数: 1217
29
来自主题: Statistics版 - Re: 招一个macro quant/PM (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: gatsbyreally (gatsby), 信区: JobHunting
标 题: Re: 招一个macro quant/PM (转载)
发信站: BBS 未名空间站 (Thu Mar 27 13:25:18 2014, 美东)
EE/CS 有CFA 有相关经验的也可。
FX/Global Macro/rates
两个职位:
analyst focus on portfolio optimization.python.
pm需要有买方的performance data
j******g
发帖数: 1428
30
来自主题: Statistics版 - 如何pass sas macro to unix system?
比如在一个kshell文件里,我run一个sas文件,这个文件产生了一个sas macro 变量,
如何在kshell文件中引用sas macro变量呢?
谢谢。
e*****i
发帖数: 46
31
来自主题: Statistics版 - 请教 macro variable 和 PROC SQL的问题
A table里有一个column 叫作state,里面有 50个states。现在我想写一个macro,用
这个macro我可以把感兴趣的一个或者很多个州的内容调出来,创建一个新的table。比
如我感兴趣 15个州,那我把这15个州的名字列出来(AK,AL,FL,PA,NJ~~~~~),相关的
信息就写进一个新的table了。
proc sql;
select *
from A
group by state
having state in (“某一个state”);
quit;
这个方法太笨了,有没有什么更简便快捷的方法呢?
多谢!!
S******y
发帖数: 1123
32
来自主题: Statistics版 - SAS Macro Function
Macro functions operate like regular SAS functions, except that they are
executed in the context of the macro language.
m***c
发帖数: 118
33
来自主题: Statistics版 - SAS Macro Function

SAS如果没有macro,那么SAS至少折价一半。就我个人而言,SAS最大的魅力就是macro.
我用的最多的就是%do,%if,%scan,,,
s****i
发帖数: 116
34
来自主题: Statistics版 - 请问一个sas macro的问题 谢谢大家
我想用sas macro 来实现普通sas里的
first. 或者是 last. 的运行,请问大家我该怎么做?可以给一个类似的code sample
么, 刚开始学macro,很乱,谢谢大家
d*********d
发帖数: 239
35
编了个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结果... 阅读全帖
l********8
发帖数: 197
36
来自主题: Statistics版 - sas现在来说macro和iml哪个更方便?
用MACRO只能减少coding的时间,runningtime是一样的,因为每次MACRO都会生成真实
的代码。
v*******e
发帖数: 11604
37
来自主题: Statistics版 - R 语言有像SAS 一样的macro吗?

我用SAS的时候就不骂macro;因为如果SAS没有那些蛋痛的macros我也不会有那个SAS的
工作。
w****m
发帖数: 21
38
来自主题: Automobile版 - 汇报: Accord LX OTD$20,754, san macros, TX
dealer 在 san macros 和 San Antonio 之间。
我从 Austin 开过去 75 mile。
价格差不多了,比 Austin 这边最低报价便宜近 800。比版上最低的报价贵几百,懒得
继续砍价了。基本配置。
信用卡 (AMX) 付了 5000,剩余的支票。
j********i
发帖数: 69
39
本不想买日本车,但是没有人给出马力布的OTD,懒得和dealer搞来搞去
正好看到有人给出Accord LX OTD$20,754, san macros, TX。
就请dealer match这个价格,dealer 同意,第二天就买好了,在 San Antonio, TX. 买
的。
利率0.9, 最少贷款3个月。是宏达自己的finance department 给的贷款。
谢谢本版,回报!
b*****n
发帖数: 17570
40
好便宜
[在 jackijacki (xiaojing) 的大作中提到:]
:本不想买日本车,但是没有人给出马力布的OTD,懒得和dealer搞来搞去
:正好看到有人给出Accord LX OTD$20,754, san macros, TX。
:...........
n*****y
发帖数: 277
41
二手交易风险自负!请自行验证是否合法和一手卡!:
我想卖的物品:
New Canon EF-S 10-22mm Macro Lens @ $700
单张面值:
$849.99
可接受价格(必须明码标价!):
700+yl
物品新旧要求:
new in hand
邮寄方式要求:
yl
买卖双方谁承担邮寄损失(Required if not code only):
default
付款方式说明:
noncc paypal
boa
check(lao xiang hao only)
其他补充说明:
广告的有效期:
tillgone
物品来源(Required for All Cards!):
staples
我的联系方式:
pm
Warranty期限:
1 year
能否证明是合法的一手卡?(Required for All Cards!):
g*********g
发帖数: 870
42
来自主题: Classified版 - [出售]new Canon 100L f2.8 macro IS
我想卖的物品:
New Canon 100L f2.8 macro IS.
Still sealed. UPC was taken off for rebate
单张面值:
可接受价格(必须明码标价!):
$780
物品新旧要求:
New
邮寄方式要求:
YL
买卖双方谁承担邮寄损失(Required if not code only):
default
付款方式说明:
non cc paypal or chase quick pay
其他补充说明:
广告的有效期:
物品来源(Required for All Cards!):
beach camera
我的联系方式:
PM
Warranty期限:
能否证明是合法的一手卡?(Required for All Cards!):
state and zip:
SC
b*****s
发帖数: 3390
43
来自主题: Classified版 - [FS] [Nikon]Sigma70-200mm F/2.8 HSM Macro II
器材名称
[Nikon]Sigma 70-200mm F/2.8 HSM Macro II(小黑四)
付款方式(需要其他付款方式请联系卖家)
Boa
卖家联系方式
站内
器材具体描述、价格、运费:
(均为现金/BOA/check/MO或non-cc paypal价,+$5 for echeck)
(其他付款方式引起的价格变动请与卖家联系)
sigma 77mm ex uv,前后盖,hood,soft case,成色挺好,镜片干净。
有意的站内联系email实物图,$620包运。
g*********g
发帖数: 870
44
来自主题: FleaMarket版 - [出售]new Canon 100L f2.8 macro IS
我想卖的物品:
New Canon 100L f2.8 macro IS.
Still sealed. UPC was taken off for rebate
单张面值:
可接受价格(必须明码标价!):
$780
物品新旧要求:
New
邮寄方式要求:
YL
买卖双方谁承担邮寄损失(Required if not code only):
default
付款方式说明:
non cc paypal or chase quick pay
其他补充说明:
广告的有效期:
物品来源(Required for All Cards!):
beach camera
我的联系方式:
PM
Warranty期限:
能否证明是合法的一手卡?(Required for All Cards!):
state and zip:
SC
g*********g
发帖数: 870
45
来自主题: FleaMarket版 - [出售]new Canon 100L f2.8 macro IS
我想卖的物品:
New Canon 100L f2.8 macro IS.
Still sealed. UPC was taken off for rebate
单张面值:
可接受价格(必须明码标价!):
$780
物品新旧要求:
New
邮寄方式要求:
YL
买卖双方谁承担邮寄损失(Required if not code only):
default
付款方式说明:
non cc paypal or chase quick pay
其他补充说明:
广告的有效期:
物品来源(Required for All Cards!):
beach camera
我的联系方式:
PM
Warranty期限:
能否证明是合法的一手卡?(Required for All Cards!):
state and zip:
SC
s******t
发帖数: 100
46
【 以下文字转载自 Programming 讨论区 】
发信人: sunlight (阳光), 信区: Programming
标 题: 请教如何在Powerpoint中使用Macros改变文字颜色
发信站: BBS 未名空间站 (Thu Aug 9 10:22:43 2012, 美东)
我想find and replace某种颜色的文字,但是Powerpoint好像不直接提供这种功能。
我的原始文件有一部分黄色的文字,我想改成蓝色,其余的保持黑色。
我在网上搜索到一个例子,但是这是改变整个文件字体的颜色,入骨哦我想选择性的改
变某种颜色的字,该如和修改。我是计算机盲,逐个改,很花时间。
谢谢大家!
Sub ChangeFontColor()
' This will change the color of all PowerPoint text to the color you specify
in RGB below
' It won't affect text in charts, pasted graphics, groups, etc.
Dim R As Integer
D... 阅读全帖
L*******s
发帖数: 138
47
我用vba时候如果不确定句子怎么写,就先打开录制macro功能再手动操作,参考录下的
句子
g**********y
发帖数: 1217
48
来自主题: JobHunting版 - 招一个macro quant/PM (转载)
【 以下文字转载自 Quant 讨论区 】
发信人: gatsbyreally (gatsby), 信区: Quant
标 题: 招一个macro quant/PM
发信站: BBS 未名空间站 (Thu Mar 27 11:39:27 2014, 美东)
工作地点在CT 或NYC
基本要求:数学/经济/统计/金融 PhD,2-3年经验
站内联系。
g**********y
发帖数: 1217
49
来自主题: JobHunting版 - 招一个macro quant/PM (转载)
EE/CS 有CFA 有相关经验的也可。
FX/Global Macro/rates
两个职位:
analyst focus on portfolio optimization.python.
pm需要有买方的performance data
g**********y
发帖数: 1217
50
来自主题: JobHunting版 - 招一个macro quant/PM (转载)
感谢大家来信!有些就不一一回复了。
fresh master/phd 这次不考虑了
基本可以朝九晚五,不用经常加班,加班的话补贴优厚。
买方背景的优先考虑。FX/Global Macro
python用的好最好啦
做优化的最fit
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)