[R] Import selected columns from sas7bdat file

peter dalgaard pdalgd at gmail.com
Thu Aug 10 13:42:32 CEST 2017


I had a look at this a while back and it didn't seem to be easy. The path of least resistance would seem to be to use SAS itself to create a data set with fewer columns, but of course that requires you to get access to SAS. 

Otherwise, I think you'd have to modify sas7bdat::read.sas7bdat to drop unselected columns. That function is pure R code, so it might not be quite as hard as it sounds.

Incidentally, do teach your mailer to not send plain text. It is not much of a problem this time, but HTML mails can become quite unreadable on the list.


-pd


> On 10 Aug 2017, at 12:24 , Utkarsh Singhal <utkarsh.iit at gmail.com> wrote:
> 
> Hello everyone,
> 
> I want to import data from huge sas files with 100s of columns. The good
> thing is that I am only interested in a few selected columns. Is there any
> way to do that without loading the full dataset.
> 
> I have tried two functions: (1) read.sas7bdat *[from library 'sas7bdat']*,
> and (2) read_sas *[from library 'haven']. *But couldn't find what I am
> looking for.
> 
> Best regards,
> Utkarsh Singhal
> 91.96508.54333
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list