楼主: caibirdcnb
4116 25

[原创博文] 请问高手如何组合N个宏变量名,谢谢! (还没解决啊) [推广有奖]

  • 0关注
  • 37粉丝

讲师

47%

还不是VIP/贵宾

-

威望
0
论坛币
1367 个
通用积分
16.5538
学术水平
67 点
热心指数
70 点
信用等级
64 点
经验
6762 点
帖子
206
精华
2
在线时间
433 小时
注册时间
2011-8-31
最后登录
2023-9-23

楼主
caibirdcnb 发表于 2011-10-31 11:56:31 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
例如有3个宏变量,名称分别为L1, L2, L3。(是宏变量名称,不是内容)
想得到1个新的宏变量,名称任意,内容为L1 L2 L3。

例如有5个宏变量,名称分别为L1, L2, L3, L4, L5。(是宏变量名称,不是内容)
想得到1个新的宏变量,名称任意,内容为L1 L2 L3 L4 L5。

非常感谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:非常感谢 如何

回帖推荐

soporaeternus 发表于8楼  查看完整内容

也许对你有帮助

本帖被以下文库推荐

沙发
bobguy 发表于 2011-11-1 08:35:38
Not really sure what are you asking. Would you please give an example?

藤椅
playmore 发表于 2011-11-1 09:45:01
紧密连接:%let A=%SYSFUNC(CATS(&L1,&L2,&L3,...));
中间加空格:%let A=%SYSFUNC(CATX(%STR( ),&L1,&L2,&L3,...));
playmore邀请您访问ChinaTeX论坛!!!进入ChinaTeX论坛

板凳
caibirdcnb 发表于 2011-11-1 09:50:10
thanks bobguy. Here is the example:
assume I have macro variables L1 L2 L3, I need to get the fourth macro variable named A(or what else) and its content must be "L1 L2 L3".
assume I have L1 L2, then I need A = "L1 L2". ... (w/o "")
assume I have L1 L2 L3 L4, then I need A = "L1 L2 L3 L4". ... (w/o "")

The purpose to get this combo is to use in the proc template like:
proc template;
mvar L1 L2 L3 L4...;  *and I would like to use one macro viriable instead of L1-Ln because the n is unknown;

Thank you very much for your help.

报纸
caibirdcnb 发表于 2011-11-1 09:53:11
playmore 发表于 2011-11-1 09:45
紧密连接:%let A=%SYSFUNC(CATS(&L1,&L2,&L3,...));
中间加空格:%let A=%SYSFUNC(CATX(%STR( ),&L1,&L2, ...
非常感谢!这种方法有效。但是L1-Ln中的n是未知的。所以。。。

地板
soporaeternus 发表于 2011-11-1 10:07:34
对macro的脚标做宏循环
Let them be hard, but never unjust

7
caibirdcnb 发表于 2011-11-1 10:09:44
soporaeternus 发表于 2011-11-1 10:07
对macro的脚标做宏循环
请问具体如何实现呢?非常感谢!

8
soporaeternus 发表于 2011-11-1 10:19:11
caibirdcnb 发表于 2011-11-1 10:09
请问具体如何实现呢?非常感谢!
  1. %MACRO T;
  2.         %do i=1 %to 10 %by 1;
  3.                 %let X&i=%SYSFUNC(ranuni(123));
  4.         %end;
  5.         %do i=1 %to 10 %by 1;
  6.                 %put X&i=&&X&i;
  7.         %end;
  8. %MEND T;
  9. %T;
复制代码
也许对你有帮助
已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

Let them be hard, but never unjust

9
caibirdcnb 发表于 2011-11-1 10:32:38
soporaeternus 发表于 2011-11-1 10:19
也许对你有帮助
soporaeternus,非常惭愧,我看不懂这个程序。

这个程序似乎只是产生10个宏变量吧?
我的目的是把N个有规律的宏变量名组合起来(不是宏变量内容,也不是产生N个宏变量)作为1个新的宏变量的内容(新的宏变量名无所谓)。

再次感谢你的帮助。

10
来梦来人 发表于 2011-11-1 11:02:14
学习了

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-9 03:38