Reading a SAS dataset with Ruby? - ruby

I'd like to be able to read a SAS dataset with Ruby. Does anyone know of a way to do this?

If you have access to a local instance of SAS or to a SAS/SHARE server, you can use the SAS ODBC driver to connect to and read from SAS data libraries. I run a SAS/SHARE server myself and access it from Excel all the time.
See the SAS ODBC Driver User Manual for the version of SAS you are using for more info.

SAS dataset files are coded in a proprietary format. If you have access to SAS, you can export the dataset as a delimited text file, and then read that with Ruby. If you don't have access to SAS, you could look into getting StatTransfer, but it's not cheap.

It is possible to do what you want.
You could use the ruby gem Pandas.rb to
# Untested
require 'pandas'
df = Pandas.read_sas("./path/to/dataset.sas7bdat")
Alternatively, with some development effort you could implement the logic in Pandas sas7bdat.py and xport.py

Related

How to use bcp utility with oracle dB or any other better options

I have a csv file which has to be bulk imported to oracle dB. I was working on other sybase dB engine before so I had a sample script which has the environment setup for it. Right now I have to do the process in a oracle dB so what should be the first line I know about the rest other parameters but want to know the path which has to be defined when I write
path/bcp dbtable in data.txt
If anyone could help what should be the path for oracle dB
The primary tools for bulk or flat file loading are:
SQL*Loader
External Tables (and here)
GUI Tools like SQL*Developer
It is much more cumbersome, but if necessary you can roll your own solution with the UTL_FILE PL/SQL package.

Read MS Access .mdb database using Ruby on Linux

Is there any way to query tables from a Microsoft Access .mdb database using Ruby on a Linux platform?
I would like to read directly, not convert to Mysql then read. In fact, being more specific, I would like to query the tables i.e. add filters etc

accessing a database from ruby using an odbc driver (Remedy)

I have the Remedy odbc driver installed on my machine. I am able to pull down data from Remedy via excel just fine specifying this driver in my connection.
Is there any way I could use this driver from within Ruby / Ruby on rails to connect to and read from the DB?
Many thanks!
I have not found a way to use the Remedy ODBC driver from Ruby. Also, I am suspecting that using the driver which seems to be quite antiquated and is already throwing some arcane errors when used from Excel might not be simple to use.
I was able to connect through R via RODBC and thus an R script that would pull the data for you and write to CSV might be a solution.
What I am actually using - which to my mind is the simplest way of achieving this - is talking directly to the Remedy SQL backend. All that you will have to do is parse the data upon pulling it from DB which is very easy to set up (priorities, service types, statuses are stored as integers and not actual names and timestamps are in epoch format).

Is there any easy way to save BLOB into client-side file system in Oracle?

Is there any easy way to save BLOB as a binary file into client-side file system with using of only standard Oracle utilities (such as sqlplus or sqlldr for example)?
I've already looked onto UTL_FILE package, but actually I have two problems with it:
I have doubts that it can work with client-side file system.
I have no privilege to CREATE DIRECTORY in schema where BLOBs are saved and so that I can't work with UTL_FILE at all.
Also, I know that I can just write some homebred utility in any language (Java for example); connect to Oracle, select my BLOB and save it in binary format. But I'd look for some easier way before doing this.
Would you really want a database writing a BLOB, for example winword.exe, to your local PC ? This is the sort of thing that is intentionally quite protected.
It is very client driven, so the best place to start is with whatever is running on your local machine. I'd go with a Java routine, or if you've got APEX running, a simple procedure that will push the BLOB out through the browser and let the browser prompt you for what to save it.

Importing Data from a Microsoft Access File on a Mac

I have an MS-Access mdb file that I need to import data from into my mysql instance. I am on a mac, is there any free/OSS tools that allow me to do that? If not, is there a free/OSS JDBC driver that I can use to extract the data I need?
Thanks.
Have a look at Jackcess. Note that this doesn't support Access 97 databases, however, only 2000+.
For Access 97, the only thing I'm aware of is mdbtools, but that's a C library, so you'll have to write some JNI glue code if you want to use it from Java; also, it's not maintained anymore, to the best of my knowledge.
UCanAccess is a pure-Java JDBC driver that can read from and write to Access 2000 and newer databases. (Access 97 files are supported read-only.) It will work on any machine that runs Java.
For more details see
Manipulating an Access database from Java without ODBC
Is your Access MDB on mac?
Does the mac Access have the option of using linked tables?
If so, you can create a Linked Table from Access MDB to mySQL. Then, you could treat mysql tables as if it were part of MS-Access.
EDIT: See if this helps.
You could export the MDB file using something like this. This won't help you if you need to do it from within your app, but if you are ok exporting the data then using it, then this should help.
I do the following way to convert;
Download ACCDB MDB Explorer
http://accdb-mdb-explorer.en.softonic.com/mac
Open the MDB file
Export as SQL
Import in MySQL using MySQL Workbench.
Hope it helps..

Resources