如何读取 SAS 数据集中的变量名称? [英] How to read variable names in a SAS data set?

查看:43
本文介绍了如何读取 SAS 数据集中的变量名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何语句\函数能够获取变量的名称?最好将它们放入另一个数据集的列、文本字段或宏变量中.

Are there any statements\functions capable of get the name of variables? Preferrably putting them into a column of another data set, a text field or a macro variable.

例如

- 数据集 1

Name age sex

    Jk   14   F
    FH   34   M

  • 预期数据集

    • Expected data set

      Var_name_of_dataset1

      Name
      age
      sex
      

    • PS:我知道一个语句:select into,它做某事相关它可以使用自定义分隔符将列的值读入字段,因此希望有类似的方法将列名读入字段或列.

      PS: I know a statement: select into, which does sth relevantly It can read the value of a column into a field with customized separetors, and therefore wish there are similar ways of reading column names into a field or a column.

      谢谢

      推荐答案

      PROC CONTENTS 将是在数据集中获取该信息的最快方法.列名称可以在列名称中找到.

      PROC CONTENTS would be the quickest way to get that information in a dataset. Column names can be found in the column NAME.

      proc contents data=sashelp.class out=contents noprint;
      run;
      

      这篇关于如何读取 SAS 数据集中的变量名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆