楼主: 小鳄鱼a
1783 6

语句赋给宏变量 [推广有奖]

  • 6关注
  • 10粉丝

已卖:280份资源

学科带头人

3%

还不是VIP/贵宾

-

威望
0
论坛币
125 个
通用积分
0.0040
学术水平
40 点
热心指数
45 点
信用等级
43 点
经验
32801 点
帖子
1185
精华
0
在线时间
1539 小时
注册时间
2009-7-16
最后登录
2018-10-5

楼主
小鳄鱼a 发表于 2014-12-5 10:52:38 |AI写论文
30论坛币

data a1 a2;
set a;
if d=4;
if da=&i then output a1;
if da=&j then output a2;
keep monthnum rfundeq dalpflag ;
run;


现在想把
if d=4;
if da=&i then output a1;
if da=&j then output a2

赋给cha

使得在宏中调用的时候能够用

data a1 a2;
set a;
&cha;
keep monthnum rfundeq dalpflag ;
run;



语法应该很多错了,仅仅表述个人意思




最佳答案

jl60156 查看完整内容

you could use macro %macro cha; if d=4; if da=&i then output a1; if da=&j then output a2 %mend cha; data a1 a2; set a; %cha; keep monthnum rfundeq dalpflag ; run;
关键词:output outpu month Then keep

沙发
jl60156 发表于 2014-12-5 10:52:39
you could use macro

%macro cha;
if d=4;
if da=&i then output a1;
if da=&j then output a2
%mend cha;

data a1 a2;
set a;
%cha;
keep monthnum rfundeq dalpflag ;
run;

藤椅
小鳄鱼a 发表于 2014-12-5 11:35:59
jl60156 发表于 2014-12-5 11:24
you could use macro

%macro cha;
WARNING: 没有解析宏 CHA 的调用。
ERROR 180-322: 语句无效或未按正确顺序使用。

板凳
小鳄鱼a 发表于 2014-12-5 11:37:28
jl60156 发表于 2014-12-5 11:24
you could use macro

%macro cha;
哦    看错了   可以解析宏变量

报纸
小鳄鱼a 发表于 2014-12-5 11:40:37
jl60156 发表于 2014-12-5 11:24
you could use macro

%macro cha;
语句不能直接在data步中使用,却可以利用宏调用,挺神奇的

地板
jl60156 发表于 2014-12-5 11:46:30
if you prefer &cha then you could try the following

%let cha=%QUOTE(
if d=4;
if da=&i then output a1;
if da=&j then output a2
);

7
小鳄鱼a 发表于 2014-12-5 11:54:03
jl60156 发表于 2014-12-5 11:46
if you prefer &cha then you could try the following

%let cha=%QUOTE(
能否讲讲  
跳转:%goto xxx;
定义为: %xxx:


当xxx有没有local  或者global 之分啊

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 18:47