[R] SPSS long variable names

Orvalho Augusto orvaquim at gmail.com
Wed Oct 14 17:48:46 CEST 2009


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