Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在SAS中使用数据步骤删除重复项?_Sas_Duplicates_Remove_Datastep - Fatal编程技术网

如何在SAS中使用数据步骤删除重复项?

如何在SAS中使用数据步骤删除重复项?,sas,duplicates,remove,datastep,Sas,Duplicates,Remove,Datastep,如何在SAS中使用数据步骤删除重复项 在下面的数据集中,删除sex变量中的重复项 data ds; set sashelp.class; by sex notsorted; if first.variable then output; run; 您应该使用first.sex而不是first.variable: proc print data = sashelp.class noobs; run; /* Name Sex Age Heig

如何在SAS中使用数据步骤删除重复项

在下面的数据集中,删除
sex
变量中的重复项

data ds;
    set sashelp.class;
    by sex notsorted;
    if first.variable then output;
    run;

您应该使用
first.sex
而不是
first.variable

proc print data = sashelp.class noobs;
run;

/*
Name       Sex    Age    Height    Weight

Alfred      M      14     69.0      112.5
Alice       F      13     56.5       84.0
Barbara     F      13     65.3       98.0
Carol       F      14     62.8      102.5
Henry       M      14     63.5      102.5
James       M      12     57.3       83.0
Jane        F      12     59.8       84.5
Janet       F      15     62.5      112.5
Jeffrey     M      13     62.5       84.0
John        M      12     59.0       99.5
Joyce       F      11     51.3       50.5
Judy        F      14     64.3       90.0
Louise      F      12     56.3       77.0
Mary        F      15     66.5      112.0
Philip      M      16     72.0      150.0
Robert      M      12     64.8      128.0
Ronald      M      15     67.0      133.0
Thomas      M      11     57.5       85.0
William     M      15     66.5      112.0
*/


data ds;
    set sashelp.class;
    by sex notsorted;
    if first.sex then output;
run;

proc print data = ds noobs;
run; 

/*
Name       Sex    Age    Height    Weight

Alfred      M      14     69.0      112.5
Alice       F      13     56.5       84.0
Henry       M      14     63.5      102.5
Jane        F      12     59.8       84.5
Jeffrey     M      13     62.5       84.0
Joyce       F      11     51.3       50.5
Philip      M      16     72.0      150.0
*/

关于,

给定sashelp.class,您想要的结果是什么?欢迎使用堆栈溢出!我建议您阅读“”,您应该提供一个。这样,一些用户可以更好地帮助您。