Does anyone know how to read SPSS .por (ie Portable) files? The foreign package only deals with SPSS .sav files and not with those with a "por" extension. Thanks, José Mr José Luis Iparraguirre D'Elia Senior Research Economist Economic Research Institute of Northern Ireland Floral Buildings 2 - 14 East Bridge Street Belfast BT1 3NQ Northern Ireland United Kingdom Tel: 028 9072 7350 Fax: 028 9031 9003 www.erini.ac.uk <http://www.erini.ac.uk/> [[alternative HTML version deleted]]
On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote:> Does anyone know how to read SPSS .por (ie Portable) files? The foreign > package only deals with SPSS .sav files and not with those with a "por" > extension.Not so. ?read.spss says 'read.spss' reads a file stored by the SPSS 'save' or 'export' commands. It says nothing about extensions, but it seems .por is commonly used in the 'export' SPSS command, and there is an example in the test suite of the foreign package. Did you actually try it? (If so, you failed to report the error message you got.)> > Thanks, > > Jos? > > > > Mr Jos? Luis Iparraguirre D'Elia > > Senior Research Economist > > Economic Research Institute of Northern Ireland > > Floral Buildings > > 2 - 14 East Bridge Street > > Belfast BT1 3NQ > > Northern Ireland > > United Kingdom > > > > Tel: 028 9072 7350 > > Fax: 028 9031 9003 > > www.erini.ac.uk <http://www.erini.ac.uk/> > > > > > [[alternative HTML version deleted]] > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thanks Brian, The error message reads as follows: Error in read.spss("G:/Jose/Life and Times Survey/LT 2007/nilt07w1.por") : error reading portable-file dictionary Jos? -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: 18 July 2008 14:38 To: Jose Iparraguirre D'Elia Cc: r-help at r-project.org Subject: Re: [R] Reading SPSS .por files On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote:> Does anyone know how to read SPSS .por (ie Portable) files? The foreign > package only deals with SPSS .sav files and not with those with a "por" > extension.Not so. ?read.spss says 'read.spss' reads a file stored by the SPSS 'save' or 'export' commands. It says nothing about extensions, but it seems .por is commonly used in the 'export' SPSS command, and there is an example in the test suite of the foreign package. Did you actually try it? (If so, you failed to report the error message you got.)> > Thanks, > > Jos? > > > > Mr Jos? Luis Iparraguirre D'Elia > > Senior Research Economist > > Economic Research Institute of Northern Ireland > > Floral Buildings > > 2 - 14 East Bridge Street > > Belfast BT1 3NQ > > Northern Ireland > > United Kingdom > > > > Tel: 028 9072 7350 > > Fax: 028 9031 9003 > > www.erini.ac.uk <http://www.erini.ac.uk/> > > > > > [[alternative HTML version deleted]] > >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
However, it can be read in SPSS. The file is available on the web, as it corresponds to the raw database of the Northern Ireland Life and Times Survey 2007 (http://www.ark.ac.uk/nilt/datasets/). It is a file that SPSS recognises; albeit the foreign package doesn't -hence my initial query. Jos? -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: 18 July 2008 15:50 To: Jose Iparraguirre D'Elia Cc: r-help at r-project.org Subject: RE: [R] Reading SPSS .por files On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote:> Thanks Brian, > > The error message reads as follows: > > Error in read.spss("G:/Jose/Life and Times Survey/LT 2007/nilt07w1.por") : > error reading portable-file dictionarySo it looks like it is not a portable file, or at least one that read.spss knows about.> > Jos? > > -----Original Message----- > From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] > Sent: 18 July 2008 14:38 > To: Jose Iparraguirre D'Elia > Cc: r-help at r-project.org > Subject: Re: [R] Reading SPSS .por files > > On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote: > >> Does anyone know how to read SPSS .por (ie Portable) files? The foreign >> package only deals with SPSS .sav files and not with those with a "por" >> extension. > > Not so. ?read.spss says > > 'read.spss' reads a file stored by the SPSS 'save' or 'export' > commands. > > It says nothing about extensions, but it seems .por is commonly used in > the 'export' SPSS command, and there is an example in the test suite of > the foreign package. > > Did you actually try it? (If so, you failed to report the error message > you got.) > >> >> Thanks, >> >> Jos? >> >> >> >> Mr Jos? Luis Iparraguirre D'Elia >> >> Senior Research Economist >> >> Economic Research Institute of Northern Ireland >> >> Floral Buildings >> >> 2 - 14 East Bridge Street >> >> Belfast BT1 3NQ >> >> Northern Ireland >> >> United Kingdom >> >> >> >> Tel: 028 9072 7350 >> >> Fax: 028 9031 9003 >> >> www.erini.ac.uk <http://www.erini.ac.uk/> >> >> >> >> >> [[alternative HTML version deleted]] >> >> > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote:> However, it can be read in SPSS. The file is available on the web, as it corresponds to the raw database of the Northern Ireland Life and Times Survey 2007 (http://www.ark.ac.uk/nilt/datasets/). It is a file that SPSS recognises; albeit the foreign package doesn't -hence my initial query.Which is not inconsistent with what I told you.> > Jos? > > -----Original Message----- > From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] > Sent: 18 July 2008 15:50 > To: Jose Iparraguirre D'Elia > Cc: r-help at r-project.org > Subject: RE: [R] Reading SPSS .por files > > On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote: > >> Thanks Brian, >> >> The error message reads as follows: >> >> Error in read.spss("G:/Jose/Life and Times Survey/LT 2007/nilt07w1.por") : >> error reading portable-file dictionary > > So it looks like it is not a portable file, or at least one that read.spss > knows about. > >> >> Jos? >> >> -----Original Message----- >> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] >> Sent: 18 July 2008 14:38 >> To: Jose Iparraguirre D'Elia >> Cc: r-help at r-project.org >> Subject: Re: [R] Reading SPSS .por files >> >> On Fri, 18 Jul 2008, Jose Iparraguirre D'Elia wrote: >> >>> Does anyone know how to read SPSS .por (ie Portable) files? The foreign >>> package only deals with SPSS .sav files and not with those with a "por" >>> extension. >> >> Not so. ?read.spss says >> >> 'read.spss' reads a file stored by the SPSS 'save' or 'export' >> commands. >> >> It says nothing about extensions, but it seems .por is commonly used in >> the 'export' SPSS command, and there is an example in the test suite of >> the foreign package. >> >> Did you actually try it? (If so, you failed to report the error message >> you got.) >> >>> >>> Thanks, >>> >>> Jos? >>> >>> >>> >>> Mr Jos? Luis Iparraguirre D'Elia >>> >>> Senior Research Economist >>> >>> Economic Research Institute of Northern Ireland >>> >>> Floral Buildings >>> >>> 2 - 14 East Bridge Street >>> >>> Belfast BT1 3NQ >>> >>> Northern Ireland >>> >>> United Kingdom >>> >>> >>> >>> Tel: 028 9072 7350 >>> >>> Fax: 028 9031 9003 >>> >>> www.erini.ac.uk <http://www.erini.ac.uk/> >>> >>> >>> >>> >>> [[alternative HTML version deleted]] >>> >>> >> >> -- >> Brian D. Ripley, ripley at stats.ox.ac.uk >> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ >> University of Oxford, Tel: +44 1865 272861 (self) >> 1 South Parks Road, +44 1865 272866 (PA) >> Oxford OX1 3TG, UK Fax: +44 1865 272595 >> > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Many thanks to you both, Jos? -----Original Message----- From: Peter Dalgaard [mailto:p.dalgaard at biostat.ku.dk] Sent: 18 July 2008 18:19 To: Jose Iparraguirre D'Elia Cc: Prof Brian Ripley; r-help at r-project.org Subject: Re: [R] Reading SPSS .por files Jose Iparraguirre D'Elia wrote:> [snip] > >> Thanks Brian, >> >> The error message reads as follows: >> >> Error in read.spss("G:/Jose/Life and Times Survey/LT 2007/nilt07w1.por") : >> error reading portable-file dictionary >> > > So it looks like it is not a portable file, or at least one that read.spss > knows aboutActually, no. I noticed that it had "8bit ascii" characters inside so on a hunch I sent it through iconv and got a different error message > read.spss("xxx.por", use.value.labels=FALSE) Error in read.spss("xxx.por", use.value.labels = FALSE) : file 'xxx.por' is not in any supported SPSS format So read.spss() recognizes the format of the original file alright, it's just that something in the file does not match the format that read.spss() expects. It reads at least one .por file, namely the one that ships with the source for the foreign package in the tests directory (pbc.por). It is not unlikely that it can be confused by character set encodings and CR/LF inside value labels, though. -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907