由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - help for sas program
相关主题
关于recode data的问题,多谢。[问题]怎么用proc sql获取row number的值
问个sas编程的题Sas advance chapter quiz 一问
遇到一个SAS问题问一个sas问题
sas question求助!请教我这个SAS code哪里错了啊?
SAS 问题求助,有包子求问 sas _c_ 什么意思
Import excel file to sas (the first 8 or more observations急问,在线等:SAS adv certification Question about SELECT v.s IF/THEN ELSE
SAS help needed!SAS快捷键问题
召唤!向大家请教1个sas 问题[合集] 说一个proc sort的很简单却总有人错的问题
相关话题的讨论汇总
话题: dloc话题: program话题: 10话题: alt48si话题: 36
进入Statistics版参与讨论
1 (共1页)
a********a
发帖数: 346
1
I am cleaning a data set as following, if all 36 variable are missing, I am
going to delete the observation. The following program works for me, but I
do not think it is a good program. Please help me if you have a better idea
to change the array part of my program.
Thanks
data mis;
set spt_dloc;
array m{36} ALT48SI CLAD48SI COD48SI PEA48SI EGG48SI MILK48SI SOYA48SI
WHEA48SI GRAS48SI
CAT48SI DOG48SI HDM48SI
ALTERNARIAMEANDIAMETER_10 CLADOSPORIUMMEANDIAMETER_10
f********t
发帖数: 117
2
I have a couple of ideas. they are pretty much same.
create of new column which is the product of all the 36 columns. this asume
they are all numbers.
then you check to see newcolumn is .
same idea in proc sql .
SELECT * from (select S.*, COALESCE (s.ALT48SI, .... 36 columns) AS
newcolumn from spt_dloc) nn where newcolumn = .
or you can do select * from spt_dloc where ALT48SI = . and 36 columns here.
s*r
发帖数: 2757
3
do these columns stay together?
g*******y
发帖数: 380
4
可以不用array,记得可以用其它方法选择所有变量,所有数字变量或者所有字符变量
,google一下吧。
h******e
发帖数: 1791
5
是这些吗?_all_, _character_, _numeric_

【在 g*******y 的大作中提到】
: 可以不用array,记得可以用其它方法选择所有变量,所有数字变量或者所有字符变量
: ,google一下吧。

c*******o
发帖数: 3829
6
Since all the variables are numeric, the following codes should work:
data mis (drop=total);
set spt_dloc;
array m{*} _all_;
total= sum(of m{*});
if total ne . then output;
run;
p********a
发帖数: 5352
7
如果变量都连在一起,可用如下搞定:
data non_mis;
set spt_dloc;
if sum(of ALT48SI--HDMMEANDIAMETER_18) ne .;
run;
w***y
发帖数: 114
8
proc contents data=A(drop=variable list you donot need) out=B(keep=name);
proc sql;
select name into:var separated by ", "
from B
;
quit;
data C;
set A;
d=sum(&var);
if d=. then delete;
run;
a********a
发帖数: 346
9
Thank you all for giving great ideas. If you use sum function, I am afraid
it will give wrong result.
For example,
a b
1 .
1 2
. .
if you let sum=a+b, it will give
a b sum
1 . .
1 2 3
. . .
If fact I only want the observations with both a and b are missing.
S***e
发帖数: 108
10
data mis;
set spt_dloc;
array m{36} ALT48SI CLAD48SI COD48SI PEA48SI EGG48SI MILK48SI SOYA48SI
WHEA48SI GRAS48SI
CAT48SI DOG48SI HDM48SI
ALTERNARIAMEANDIAMETER_10 CLADOSPORIUMMEANDIAMETER_10
CODMEANDIAMETER_10 PEANUTMEANDIAMETER_10 EGGMEANDIAMETER_10
MILKMEANDIAMETER_10 SOYAMEANDIAMETER_10 WHEATMEANDIAMETER_10
GRASSMEANDIAMETER_10 CATMEANDIAMETER_10 DOGMEANDIAMETER_10
HDMMEANDIAMETER_10
ALTERNARIAMEANDIAMETER_18 CLADOSPORIUMMEANDIAMETER_18
CODMEANDIAMETER_18 PEANUTMEANDIAMETER_18 EGGMEANDIAMETER
1 (共1页)
进入Statistics版参与讨论
相关主题
[合集] 说一个proc sort的很简单却总有人错的问题SAS 问题求助,有包子
[合集] SAS问题求助-如何把普通变量的值传递给宏变量Import excel file to sas (the first 8 or more observations
What is wrong with following code? SAS help needed!
求教一个sas读data的问题召唤!向大家请教1个sas 问题
关于recode data的问题,多谢。[问题]怎么用proc sql获取row number的值
问个sas编程的题Sas advance chapter quiz 一问
遇到一个SAS问题问一个sas问题
sas question求助!请教我这个SAS code哪里错了啊?
相关话题的讨论汇总
话题: dloc话题: program话题: 10话题: alt48si话题: 36