limit - Outputting the top 10% in SAS -
how can limit number of observations output in sas top 10%? know obs= function, haven't been able figure out how make obs= lead percentage.
thanks in advance!
as far know there's not direct way you're asking. pretty write macro this, though.
assuming you're asking view first 10% of records in proc print, this.
%macro top10pct(lib=work,dataset=); proc sql noprint; select max(ceil(0.1*nlobs)) :_nobs dictionary.tables upcase(libname)=upcase("&lib.") , upcase(memname)=upcase("&dataset."); quit; proc print data=&lib..&dataset.(obs=&_nobs.); run; %mend top10pct;
dictionary.tables
has of proc contents information available it, including number of logical observations (nlobs). number not 100% guaranteed accurate if you've been doing things dataset deleting observations in sql, sas datasets accurate, or close enough. rdbms tables may undefined or may not accurate.
Comments
Post a Comment