[R] SPSS long variable names

Orvalho Augusto orvaquim at gmail.com
Wed Oct 14 19:18:34 CEST 2009


I will try that then.


On Wed, Oct 14, 2009 at 6:53 PM, joris meys <jorismeys at gmail.com> wrote:
> You could read in the sps file in R with readLines() for example, and
> then use the tools for regular expression and substring to find the
> label statements. Then you can just use R to add the labels to it,
> without having to pass through PSPP.
> So you could actually just create an R script that takes both files as
> input, and generates the output automatically. I's prefer to do it
> that way than to use YAP (yet another program), while waiting for the
> adaptation of read.spss...
> Cheers
> Joris
> On Wed, Oct 14, 2009 at 5:48 PM, Orvalho Augusto <orvaquim at gmail.com> wrote:
>> Hi
>> The .dat file is a tab delimited file with the long variables names on
>> it. The .sps file has the instructions to read the .dat and place all
>> the variable and value labels.
>> The ideia of reading the dat directely is good but I need the labels
>> placed. Yes I could read the dat file and parese myself the sps to get
>> sps file but that it is a job that to try and by these mails I will
>> have to do so.
>> For now what I made a little script to generate the sav using pspp;
>> Then I read the sav with read.spss. Then I call read.delim to read the
>> long names on the dat file. It works but is not beautfull and uses
>> more resources.
>> The great thing would be to support long variables names on read.spss.
>> Thanks guys for everything
>> Caveman
>> On Wed, Oct 14, 2009 at 4:52 PM, joris meys <jorismeys at gmail.com> wrote:
>>> Hi Orvalho,
>>> question : where do the .dat files come from and what do you have to
>>> do with the SPSS syntax files. I guess the syntax file is to change
>>> the .dat file into SPSS format. But you could take the shortcut and
>>> read in the .dat file directly. If the SPSS syntax file is a text file
>>> (which should be), you can construct your own function to read in all
>>> specifications from the syntax file. the function regexp() can be a
>>> great help for that.
>>> If you have no clue how to do that, just send me an example, and I'll
>>> take a look.
>>> Cheers
>>> Joris
>>> On Sat, Oct 10, 2009 at 6:14 PM, Orvalho Augusto <orvaquim at gmail.com> wrote:
>>>> Hello guys I am new to this list and for R too.
>>>> I am wondering if there is a patch for the SPSS reading code on the
>>>> foreign package, in order to be able to read long variable names.
>>>> Right now read.spss() just trunc the names to 8 characters.
>>>> Or if someone could help me on other way:
>>>> I have to process everyday a lot of SPSS Syntax Files and Dat files
>>>> that come from one system that can only export data on through that
>>>> way.
>>>> I use PSPP to generate the spss data file (sav) that I read with R.
>>>> >From R I can export to MySQL, DBF and STATA to satisfy the needs of
>>>> different guys here.
>>>> The problem is the limit of 8 characters long on variable names.
>>>> Can someone help on that?
>>>> Caveman
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list