SAS Programming Professionals,
One of our projects makes SAS data sets available to users as SAS transport files created by CPORT. Most of our users have SAS (of course) and use PROC CIMPORT to un-transport the files into SAS data sets.
A few of our users only have R. They are having issues importing a CPORT-created SAS data set into R. So, my question is: Can anybody offer a solution for how an R user can import a CPORT-created SAS data set into R?
NOTE: We are aware that transport data sets created by the venerable, ancient PROC XCOPY can be imported to R. But, for data integrity issues, we do not use XCOPY.
Thank you, in advance, for your help!
--Michael
Hi MMMMIIIIKKKKEEEE,
Take a look at the HAVEN package in R: Import and Export 'SPSS', 'Stata' and 'SAS' Files, (see page 8).
Hope this helps.
Leonid,
Thank you, this is indeed helpful!
That web page will help us in the future with deliveries of SAS data sets (.sas7bdat) files for R users. I bookmarked it for the proverbial rainy day.
Because we have already "published" CPORT transport files, we are still seeking a way to read them into R.
BTW, as you know, I am a big fan of your Blog posts (https://blogs.sas.com/content/author/leonidbatkhan/). They are always insightful reading!
--Michael
Thank you MMMMIIIIKKKKEEEE,
You say "Most of our users have SAS (of course) and use PROC CIMPORT to un-transport the files into SAS data sets."
I think that is the way to do it: un-transport your CPORT files into SAS data sets, then read them in R using the haven package.
Unless anything changed since then, "R can read SAS Transport files created with the EXPORT engine (.xpt extensions), but not Transport files created with the CPORT procedure" - see SAS® and R Working Together.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.