I'm a web developer, and am brand new to SPSS. I give my web users the
ability to save result files in different formats (csv, tab delimited,
etc.) Many of the users take the CSV files, and upload them into SPSS.
This, as you know, is a multi-step process, and I would like to save
them some time by offering to save a .sav file for them. I saw the
SPSS i/o dll developer's guide documentation, but i don't see much
regarding how to interact with the i/o dll via a web application. Has
anyone worked with the SPSS i/o dll to do something like this?
Pseudo/Sample code would be much appreciated!
Many Thanks!
I don't have an answer to that, but will suggest another approach for
you to consider. It might be easier for you to generate the SPSS
syntax to import the CSV or tab delimited file. (A syntax file is just
a text file with .SPS as the extension.) This is the way EpiData
(www.epidata.dk) exports data (from a text file) to SPSS. The user
simply runs the syntax generated by EpiData.
--
Bruce Weaver
bwe...@lakeheadu.ca
www.angelfire.com/wv/bwhomedir
If you generate appropriate syntax, all they would have to do to import
the data to SPSS is open the syntax file (with SPSS) and click on
Run-->All.
Here are a few more details on the syntax EpiData generates:
1. It uses a DATA LIST command to import the data from a text file.
2. It assigns VARIABLE LABELS and VALUE LABELS.
3. It (optionally) saves the SPSS data file (.SAV) format.
To save the data in step 3, one has to uncomment one line of syntax by
removing the leading asterisk.
Another solution is to look at the portable (.por) format.
spssOpenWrite (filename, &handle);
for (v in vars) {
spssSetVarName(handle, v.name, v.type);
spssSetVarLabel(handle, v.name, v.label);
}
spssCommitHeader(handle);
for (x in cases) {
for (v in vars) {
spssSetValueNumeric(...) / spssSetValueChar(...)
}
spssCommitCaseRecord(handle);
}
spssCloseWrite(handle);
Depending on the programming language of your web app, it's more or less
easy to incorporate this stuff. CGI would work, Java servlets would need
a JNI-call.
Another possibility is to do the SPSS stuff in a independent process
that monitors some directory on the web server were the web app puts the
data.
Greetings
Marc
I'm implementing this using C# in a ASP.Net 2.0 environment. I guess
you have implemented SPSS file creation in a Web App before. The
vision I had was to give the user to ability to output the file as a
CSV or a SPSS, depending on their needs.
I tried to add the io dll as a reference in the project, but it
complains that no type libraries were found in teh component. I'm
guessing this is b/c this is unmanaged code...but i duno...
Ralph
> I'm implementing this using C# in a ASP.Net 2.0 environment. I guess
> you have implemented SPSS file creation in a Web App before. The
> vision I had was to give the user to ability to output the file as a
> CSV or a SPSS, depending on their needs.
Sorry, no web apps over here. I'm using the i/o-dll from standalone
programs. But the concepts stay the same ;)
> I tried to add the io dll as a reference in the project, but it
> complains that no type libraries were found in teh component. I'm
> guessing this is b/c this is unmanaged code...but i duno...
I guess so. I'm still using C++ (I really like it), so I'm not a big
help on C#.
Happy hacking,
Marc