BookmarkSubscribeRSS Feed
pedromagalhaes
Fluorite | Level 6

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?

15 REPLIES 15
pedromagalhaes
Fluorite | Level 6

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!

art297
Opal | Level 21

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

pedromagalhaes
Fluorite | Level 6

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.



LinusH
Tourmaline | Level 20

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
pedromagalhaes
Fluorite | Level 6

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.

LinusH
Tourmaline | Level 20

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
pedromagalhaes
Fluorite | Level 6

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..

Reeza
Super User

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

pedromagalhaes
Fluorite | Level 6

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.

LinusH
Tourmaline | Level 20

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
art297
Opal | Level 21

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.

Reeza
Super User

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.

art297
Opal | Level 21

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 15 replies
  • 19666 views
  • 0 likes
  • 4 in conversation