이렇게하는 방법은 다양하며 가장 효율적인 방법은 데이터에 따라 다릅니다. 너가 너무 많은 자료가 있지 않으면, 나는 너의 지식 및 다른 습관에 맞는 가장 쉬운 방법을 사용할 것이다.
*SQL delete;
proc sql;
delete from have H where exists (
select 1 from have V where H.ticker=V.ticker and V.corr is null);
quit;
*FREQ for missing (or means or whatever) then delete from that;
*Requires have to be sorted.;
proc freq data=have;
tables ticker*corr/missing out=ismiss(where=(missing(corr)));
run;
data want;
merge have(in=_h) ismiss(in=_m);
by ticker;
if _h and not _m;
run;
*double DoW. Requires either dataset is sorted by ticker,;
*or requires it to be organized by ticker (but tickers can be not alphabetically sorted); *and use norsorted on by statement;
data want;
do _n_=1 by 1 until (last.ticker);
set have;
by ticker;
if missing(corr) then _miss=1;
end;
do _n_=1 by 1 until (last.ticker);
set have;
by ticker;
if _miss ne 1 then output;
end;
run;
출처
2014-07-18 14:09:37
Joe
감사합니다. proc freq는 훌륭하게 작동했습니다. – Betty
누락 된 값 외에도 1, 0 또는 -1과 같은 corr도 제거 할 수 있습니까? where 명령을 또한 선택할 수있는 방법이 있습니까? 다시 한번 감사드립니다. 나는 이것을 언급한다 : 테이블 티커 * corr/missing out = ismiss (where = (missing (corr))); – Betty
'where = (missing (corr) or corr in (-1,0,1))'내가 그렇게 생각해야합니다. 필요한 모든 논리 조합. – Joe