请选择 进入手机版 | 继续访问电脑版
楼主: freetiger
3183 3

[有偿编程] 请教sas9.4的多线程代码 [推广有奖]

  • 0关注
  • 0粉丝

博士生

34%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
4.5000
学术水平
1 点
热心指数
1 点
信用等级
0 点
经验
2507 点
帖子
100
精华
0
在线时间
371 小时
注册时间
2011-1-17
最后登录
2024-1-10

freetiger 发表于 2017-1-12 19:18:56 |显示全部楼层 |坛友微信交流群
20论坛币
希望在多核机器上实现这个功能:
线程1:data a;x=1;run;
线程2:data b;y=1;run;
两个线程同时跑,结束后:data c;merge a b;run;

我参考了sas官网的例子,但是报错:
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
  1. /*The following pseudo code sets up the global SASCMD option so that N number of SAS sessions can be spawned on the same multi-processor machine. Each SIGNON statement spawns a new SAS session. The %SYSLPUT statement can be used to set macro variables in the "remote" SAS sessions. The RSUBMIT statements must have the WAIT=NO option in order to cause the RSUBMITs to execute asynchronously. In addition, the LOG=/OUTPUT= options are used in this example to manage the output and results from each of the async tasks. */

  2. options sascmd="sas";

  3. signon task1;
  4. %syslput remvar1=somevalue;

  5. rsubmit task1 wait=no log="task1.log" output="task1.lst";
  6.    /* send a task to be executed by TASK1 SAS session */
  7.    /* may make use of REMVAR1 macro variable in this  */
  8.    /* SAS code */
  9. endrsubmit;


  10. signon task2;
  11. %syslput remvar2=somevalue;

  12. rsubmit task2 wait=no log="task2.log" output="task2.lst";
  13.    /* send a task to be executed by TASK2 SAS session */
  14.    /* may make use of REMVAR2 macro variable in this  */
  15.    /* SAS code */
  16. endrsubmit;

  17. signon taskn;
  18. %syslput remvarn=somevalue;

  19. rsubmit taskn wait=no log="taskn.log" output="taskn.lst";
  20.    /* send a task to be executed by TASKn SAS session */
  21.    /* may make use of REMVARn macro variable in this  */
  22.    /* SAS code */
  23. endrsubmit;


  24. waitfor _all_ task1 task2 ... taskn;

  25. /* do some further local processing */

  26. signoff task1;
  27. signoff task2;
  28. signoff taskn;
复制代码

最佳答案

cwzkevin 查看完整内容

*- Note that the system option "-sasuser work" will cause the work folder to act as sasuser to avoid SASUSER.PROFILE error messages -; 1. 你的那个error message应该不影响使用的 2. 可以参考以下example把那个error去掉: 总体请参考此网页:http://www.datasavantconsulting.com/roland/MPConnect.html 一起学习哦
关键词:SAS9 多线程 Processing Statements statement sas 多线程 多核

回帖推荐

cwzkevin 发表于4楼  查看完整内容

Right, option statement makes it a better solution for all processes.

cwzkevin 发表于2楼  查看完整内容

*- Note that the system option "-sasuser work" will cause the work folder to act as sasuser to avoid SASUSER.PROFILE error messages -; 1. 你的那个error message应该不影响使用的 2. 可以参考以下example把那个error去掉: 总体请参考此网页:http://www.datasavantconsulting.com/roland/MPConnect.html 一起学习哦
cwzkevin 发表于 2017-1-12 19:18:57 |显示全部楼层 |坛友微信交流群
*- Note that the system option "-sasuser work" will cause the work folder to act as sasuser to avoid SASUSER.PROFILE error messages -;

1. 你的那个error message应该不影响使用的
2. 可以参考以下example把那个error去掉:
  1. rsubmit process1 wait=no log=keep output=keep sascmd="sas -sasuser work";
  2.   %include "Z:\myfolder\process1.sas";
  3. endrsubmit;
复制代码

总体请参考此网页:http://www.datasavantconsulting.com/roland/MPConnect.html
一起学习哦
已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
freetiger + 1 + 1 + 1 精彩帖子
prince315 + 10 + 10 + 1 + 1 + 1 热心帮助其他会员

总评分: 经验 + 10  论坛币 + 10  学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

使用道具

freetiger 发表于 2017-1-20 12:31:05 |显示全部楼层 |坛友微信交流群
cwzkevin 发表于 2017-1-12 19:18
*- Note that the system option "-sasuser work" will cause the work folder to act as sasuser to avoid ...
程序开始部分增加了options sascmd="sas -sasuser work";没有那些提示了

使用道具

cwzkevin 发表于 2017-1-21 06:19:16 |显示全部楼层 |坛友微信交流群
freetiger 发表于 2017-1-20 12:31
程序开始部分增加了options sascmd="sas -sasuser work";没有那些提示了
Right, option statement makes it a better solution for all processes.

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-16 16:39