Convert CSV file to SAS Table (sas7bdat)

Reply
Occasional Contributor
Posts: 8

Convert CSV file to SAS Table (sas7bdat)

I have a huge CSV file, and i want to convert it to a SAS Table. I know that i can use SAS to make an import, but i am interested in create the SAS table using, for example, C++, python or any available library.

For example, in SPSS i can easily create a SAS Table using the command "Save as type" to SAS v9+ Windows (*.sas7bdat). And it not necessary to have the SAS installed.

Is there any library to make this?

Esteemed Advisor
Posts: 7,301

Re: Convert CSV file to SAS Table (sas7bdat)

Occasional Contributor
Posts: 8

Re: Convert CSV file to SAS Table (sas7bdat)

Thanks for the response! The next challenge is to call a R function from Java/C++, for example.

If anyone know a library to C++ or Java, it will be amazing!

Esteemed Advisor
Posts: 7,301

Re: Convert CSV file to SAS Table (sas7bdat)

R isn't a function, it's a program. Here is an example of calling it from Java: Call R from JAVA to get Chi-squared statistic and p-value - Stack Overflow

Occasional Contributor
Posts: 8

Re: Convert CSV file to SAS Table (sas7bdat)

I know that R is language. But what i actually need to do is to call this function (something like this):

write.xport(df = test.df, datafile = 'test.sas7bdat', codefile = 'test.txt', package = "SAS")


Or i call the function, or execute a R Script for load the SAS table.



Esteemed Advisor
Posts: 5,202

Re: Convert CSV file to SAS Table (sas7bdat)

So you need SAS to import the export file, why would it be better to just import the original CSV-file?

What's the application, why do you want to create SAS data files if you don't have SAS?

Data never sleeps
Occasional Contributor
Posts: 8

Re: Convert CSV file to SAS Table (sas7bdat)

We have a ETL process. The ouput of the process is a csv file, in different formats.

The user always get this file and import using SAS. I would like to import it for him generating a SAS Table, using a library/DLL. That's the use case.

Esteemed Advisor
Posts: 5,202

Re: Convert CSV file to SAS Table (sas7bdat)

Still, by using R, you don't get a SAS table, you'll end up with a SAS transport file. The process to import that is very similar to import a csv-file...?

Data never sleeps
Occasional Contributor
Posts: 8

Re: Convert CSV file to SAS Table (sas7bdat)

So, I dont have a way to create a sas7bdat ?

I will have another file (similiar to CSV) that i need to import to SAS.

Why SAS dont give, for example, a DLL to create the sas7bdat? i really doesnt understand..

Grand Advisor
Posts: 17,464

Re: Convert CSV file to SAS Table (sas7bdat)

Because they want to sell SAS software?

Python can call R functions/libraries fairly easily, but that's a question that's best posted on a python/java/C forums rather than here if you think about it Smiley Happy

Occasional Contributor
Posts: 8

Re: Convert CSV file to SAS Table (sas7bdat)

If SAS make possible to generate a (sas7bdat) i will give him a FREE user... I translate my CSV fil to (sas7bdat) and now only a user with SAS can read it. So the user has to buy SAS license. So i think this argument is invalid.

Esteemed Advisor
Posts: 5,202

Re: Convert CSV file to SAS Table (sas7bdat)

I kinda agree. It's not the data sets themselves that is the big thing with SAS, it's everything you can do with the data within them.

So, when we awaits SAS to change their policy, tell us more about your SAS user(s),What kind are they, what SAS software/platform do they use? Chances are that yo can up with alternative ways to make your csv easily available to them. One way (if you csv-files have the same structure) is to create a data step view for the customer. Then they can change the csv-file, and the new data will be available instantly.

Data never sleeps
Esteemed Advisor
Posts: 7,301

Re: Convert CSV file to SAS Table (sas7bdat)

While I, too, have always wished that SAS would change their policy, one could easily rebut your argument. SAS already has your customer and (it sounds like) you could lose your customer if you can't provide what they want. That is why I suggested alternatives.

Grand Advisor
Posts: 17,464

Re: Convert CSV file to SAS Table (sas7bdat)

No, you're converting it to accommodate a SAS user. You'd have to buy a license to do so, providing SAS another customer.

I don't agree with this policy, but I sort of understand. And at any respects some people have reverse engineered it, otherwise WPS wouldn't exist, just not really open source. 

I thought R could but not willing to look into it now.

There's also the free SAS analytics U edition you could use, which would violate the license I'm sure.

Esteemed Advisor
Posts: 7,301

Re: Convert CSV file to SAS Table (sas7bdat)

Conversely, for $300 you can purchase a program that can be called from your code. Take a look at: StatTransfer.com | The Command Processor

Ask a Question
Discussion stats
  • 15 replies
  • 6967 views
  • 0 likes
  • 4 in conversation