在Proc下载中的宏

发布于 2025-02-10 08:18:21 字数 599 浏览 2 评论 0原文

我正在从服务器下载许多TXT文件。我可以一次成功执行一个文件。但是我有数据A中的许多文件路径的列表。 ”,但是程序返回错误。有人可以帮我吗?

    data B ;
    set A;
    length link link2 $ 500;
    link=substr(Name, 1);
    link2= cats('/abc/', link);
    keep link2;
    run;
    
    
    %let abc=server name;
    options comamid=TCP remote=abc;
    signon username=user password="xyz";
    
    rsubmit;
    
    * working well
    proc download infile="/abc/000009.txt"
    outfile="E:/test1.txt";


* not working

ERROR: Physical file does not exis

%let link3=link2;
proc download infile="&link3"
outfile="E:/&link3";
run;

I am downloading many txt file from a server. I can do one file at a time successfully. But the I have a list of many paths of files in data A. I try to create macro variables from paths such as " /abc/11551.txt, /abc/1832555.txt, /abc/18355557.txt", but the program return error. Could anyone please help me?

    data B ;
    set A;
    length link link2 $ 500;
    link=substr(Name, 1);
    link2= cats('/abc/', link);
    keep link2;
    run;
    
    
    %let abc=server name;
    options comamid=TCP remote=abc;
    signon username=user password="xyz";
    
    rsubmit;
    
    * working well
    proc download infile="/abc/000009.txt"
    outfile="E:/test1.txt";


* not working

ERROR: Physical file does not exis

%let link3=link2;
proc download infile="&link3"
outfile="E:/&link3";
run;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风流物 2025-02-17 08:18:21

如果意图是要下载数据集B中列出的文件,则首先将数据集移至远程服务器。

然后,您可以使用该数据生成PROC下载代码。

rsubmit;
  proc upload data=b out=b; run;
  data _null_;
    set b;
    call execute(catx(' '
     ,'proc download infile=',quote(trim(link2))
     ,'outfile=',quote(cats('E:/test',_n_,'.txt'))
     ,';run;'
    ));
  run;
endrsubmit;

我看不出宏代码将如何帮助解决此问题。

If the intent was to download the file(s) listed in the dataset B then first move the dataset to the remote server.

Then you can use that data to generate PROC DOWNLOAD code.

rsubmit;
  proc upload data=b out=b; run;
  data _null_;
    set b;
    call execute(catx(' '
     ,'proc download infile=',quote(trim(link2))
     ,'outfile=',quote(cats('E:/test',_n_,'.txt'))
     ,';run;'
    ));
  run;
endrsubmit;

I don't see how macro code would help with this problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文