| Date: | Tue, 28 Nov 2006 15:44:16 -0800 |
| Reply-To: | "Choate, Paul@DDS" <pchoate@DDS.CA.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Choate, Paul@DDS" <pchoate@DDS.CA.GOV> |
| Subject: | Re: OT: Chance to Make SAS-L History: Did You Know That... |
| In-Reply-To: | <JHEEIGIGFPGACEGDPJMGMECEICAA.bardos2@ansys.ch> |
| Content-Type: | text/plain; charset="us-ascii" |
Sorry if this is a little simple minded, but that has never stopped me
before... :)
A post today from the venerable Venky Chakravarthy reminded me of a
quick way to extract every nth record from a large dataset, without
reading the full file. This example extracts the 10,000th records from
the Zipcode file, reading only the five pertinent records:
data sample;
if 0 then set sashelp.zipcode nobs=_obs;
do _i=1 to _obs by 1e4;
set sashelp.zipcode point=_i;
output;
end;
stop;
run;
For a large file this is a quick way to extract a small evenly
distributed subset. The point= and nobs= create temporary variables, so
only the original columns are kept.
Paul Choate
DDS Data Extraction
(916) 654-2160
|