[R] How to read only ten rows from a SAS dataset (read.ssd)?
Daniel Nordlund
djnordlund at frontier.com
Tue Oct 19 21:12:36 CEST 2010
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Phil Spector
> Sent: Tuesday, October 19, 2010 10:49 AM
> To: David Winsemius
> Cc: r-help at r-project.org; johannes rara
> Subject: Re: [R] How to read only ten rows from a SAS dataset (read.ssd)?
>
> I've verified that David's solution will work, but
> a) since if is a reserved word, you must use the full name
> of the argument, namely ifs
> b) the argument passed through ifs= should be a full
> subsetting if statement.
>
> So adding
>
> ifs='if _n_ <= 10'
>
> to your sas.get call will return only the first 10 observations.
>
> - Phil Spector
> Statistical Computing Facility
> Department of Statistics
> UC Berkeley
> spector at stat.berkeley.edu
>
>
I like the sas.get function from the Hmisc package. But if for some reason the OP can't or doesn't want to use sas.get, it is fairly easy to add a parameter to the read.ssd function to limit the number of records read from the SAS dataset being exported. If the OP or anyone else is interested, they can contact me off-list and I will provide an example (no need to clutter up the list).
Dan
Daniel Nordlund
Bothell, WA USA
More information about the R-help
mailing list