Sas 如何选择数据集中的所有变量并设置为proc summary?

Sas 如何选择数据集中的所有变量并设置为proc summary?,sas,Sas,假设数据集已满,我希望选择所有变量并将它们放在proc summary语句的var语句中。有没有一个简单的方法可以做到这一点?如何在select语句中选择所有变量 proc sql noprint; select * into :all separated by " " from full; %put all = &all.; proc summary data=full print; *var &list of variable

假设数据集已满,我希望选择所有变量并将它们放在proc summary语句的var语句中。有没有一个简单的方法可以做到这一点?如何在select语句中选择所有变量

proc sql noprint; 
    select * into :all separated by " "
    from full;

    %put all = &all.;

    proc summary data=full print;
      *var &list of variables from dataset;
      class type;
      output out=work.summary;
    run; 

如有疑问,请在其他类似情况下尝试使用
\u数字
(或
\u字符
\u全部
):

FWIW,你的方法是错误的,但有一个类似的方法可以工作

proc sql;
select name into :namelist separated by ' '
from dictionary.columns
where libname='WORK' and memname='FULL' and upcase(type)='NUM';
quit;

它进入字典表(类似于PROC CONTENTS输出数据集)并将变量名拉入列表。

我可能只使用默认的列表语法。从proc contents和列表first和last变量中获取顺序。例如

proc contents data = sashelp.class position;
假设w是列出的第一个变量,n是最后一个变量,那么

proc summary data=full print;
      var w--n;
      class type;
      output out=work.summary;
    run; 
请注意,此类型的列表需要2个破折号。 如果您有顺序编号的变量,如
x1x2x3x4x5
等。 你会的

var x1-x5;
var x1-x5;