SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
MMMIIIIKKKKEEEE
Obsidian | Level 7

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

Best of luck in all your SAS endeavors!

----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)
Amazon Author's Page: http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0
3 REPLIES 3
LeonidBatkhan
Lapis Lazuli | Level 10

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.

 

 

 

MMMIIIIKKKKEEEE
Obsidian | Level 7

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

Best of luck in all your SAS endeavors!

----MMMMIIIIKKKKEEEE
(aka Michael A. Raithel)
Amazon Author's Page: http://www.amazon.com/Michael-A.-Raithel/e/B001K8GG90/ref=ntt_dp_epwbk_0
LeonidBatkhan
Lapis Lazuli | Level 10

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.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2730 views
  • 4 likes
  • 2 in conversation