开发者

SPSS 15 I/O DLL: Modifying Existing Cases

I am writing an application in C++ that interfaces with SPSS 15 using their I/O DLL.

Our SPSS database is made of a number of cases, each with their unique "ID" field.

What I need to do is open the database in read/write, find the case with the matching ID and modify some of the variables according to CSV files that my program parses.

There are 2 obvious cases from the start:

  • The matching case does not exist (In which case, I can easily use spssOpenAppend() to add the case.

  • The matching case exists. (And this is the problematic case)

In the latter, I need to use spssOpenWriteCopy() to get a write Handle and spssOpenRead() to have a read handle. While I'm not too keen on that, it seems it's the only way to do it with their DLL. The problem is that I cannot move the case pointer on the write file (Apparently, moving the case pointer is a read-only operation)

That means I am stuck trying to figure out how to modify a case without having to iterate over all the file and copy all the data, case by case, until I find the case I'm interested in.

开发者_如何学C

I'd like to add that upgrading SPSS is not an option.

I'd also like to avoid having to manually iterate case-by-case and build a new file from scratch.


I figure no one is going to bother answering now that it's solved.

Anyway, it is not possible to insert a case in the middle of a database. You could potentially write wrappers around the API to simulate it, but otherwise there is no way to do what I am trying to do without manually iterating through each case and copying it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜