首页 文章

使用infile和filename语句的数据步骤

提问于
浏览
0

有谁能告诉我们这个数据步骤的作用是什么?

data _null_;
length fname $1024;
infile a filename=fname;
call symput("a", fname);
run;

2 回答

  • 2

    这是一个null datastep,它指定一个宏变量 a .

    data _null_;              /* Returns no data table */
    length fname $1024;       /* Expects variables length and fname, 
                                 with string length 1024 */
    infile a filename=fname;  /* Reads the first file referenced */
    call symput("a", fname);  /* Writes the value of fname to a macro variable a,
                                 that can be accessed using &a. */
    run;
    

    此代码将向日志写入 a 已设置的值:

    %PUT &a.
    
  • 1

    它会将 infile a 引用的文件中最后一个文件的 fname (即文件路径)的值存储到名为 A 的宏变量中,该变量可以在以后使用 &A 进行解析 .

相关问题