[R] Error when reading a SAS transport file
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Thu Oct 9 17:33:06 CEST 2008
Jean-Louis Abitbol wrote:
> Dear All,
>
> I get the following error when using either SASxport or Hmisc to read an
> .xpt file:
>
>
>> w <- read.xport("D:/consult/Trophos/dnp/base/TRO_ds_20081006.xpt")
>>
> Erreur dans factor(x, f$value, f$label) :
> invalid labels; length 15 should be 1 or 14
>
>> z<- sasxport.get("D:/consult/Trophos/dnp/base/TRO_ds_20081006.xpt")
>>
> Erreur dans factor(x, f$value, f$label) :
> invalid labels; length 15 should be 1 or 14
>
> I don't understand what is wrong with the labels ! Is there a limit for
> their length ?
> Could the problem be in the formats label ?
>
Hmmnoo...
This is happening in R code, and the error is the same as you'd get from
> factor(1,levels=1:4,labels=1:5)
Error in factor(1, levels = 1:4, labels = 1:5) :
invalid labels; length 5 should be 1 or 4
So, not going into the actual code, I would suspect that it is
encountering a problem where a user format has values and labels out of
sync. This could well be a bug in the package(s), but I wouldn't rule
out that your data could have gotten into some inconsistent state. You
might try debugging to the trouble spot and see what is actually in
f$value and f$label at that point.
> Just in case this might help this is the output from
> test <- lookup.xport("D:/consult/Trophos/dnp/base/TRO_ds_20081006.xpt")
> print(test)
>
> for the first SAS dataset:
> SAS xport file
> --------------
> Filename: `D:/consult/Trophos/dnp/base/TRO_ds_20081006.xpt'
>
> Variables in data set `ADMIN':
> dataset name type format flength fdigits iformat iflength
> ifdigits label nobs
> ADMIN CEN numeric 5 0 0
> 0 Centre 696
> ADMIN PNO numeric 6 0 0
> 0 Pat./Subj. number 696
> ADMIN VISIT numeric VISITF 0 0 0
> 0 Visit no. 696
> ADMIN VISITR numeric 0 0 0
> 0 Visit repeat 696
> ADMIN PRO character 0 0 0
> 0 Project number 696
> ADMIN STUDY character 0 0 0
> 0 Study number 696
> ADMIN COLLDAT numeric DATE 7 0 0
> 0 Date collected (study medication) 696
> ADMIN COMM_O character 0 0 0
> 0 Comment 696
> ADMIN INEXMET numeric YESNOF 0 0 0
> 0 In-/exclusion criteria still met? 696
> ADMIN LABEL_NO numeric 4 0 0
> 0 Medication number (label) 696
> ADMIN RAND_NO numeric 4 0 0
> 0 Lowest randomisation/medication number 696
> ADMIN RETMED numeric 4 0 0
> 0 Number of capsules returned 696
> ADMIN PAGE numeric 0 0 0
> 0 Page 696
> ADMIN PAGER numeric 0 0 0
> 0 Page repeat 696
> ADMIN CT_RECID character $ 40 0 $ 40
> 0 for merge with notes and flags 696
> ADMIN RNO numeric 4 0 0
> 0 Randomisation number 696
> ADMIN SAF numeric NOYESZF 0 0 0
> 0 696
> ADMIN ITT numeric NOYESZF 0 0 0
> 0 696
> ADMIN PP numeric NOYESZF 0 0 0
> 0 696
> ADMIN SEX numeric SEXF 0 0 0
> 0 Sex 696
> ADMIN AGE_C numeric 4 0 0
> 0 Age calc 696
> ADMIN TRT numeric TRTF 0 0 0
> 0 696
> ADMIN CRF_VERS character 0 0 0
> 0 CRF Version no. 696
>
> Thanks for any help,
>
> Best wishes, Jean-Louis
>
> PS: sessionInfo()
> R version 2.7.1 RC (2008-06-20 r45965)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] SASxport_1.2.3 Hmisc_3.4-3 foreign_0.8-29 RWinEdt_1.8-0
>
> loaded via a namespace (and not attached):
> [1] chron_2.3-24 cluster_1.11.11 grid_2.7.1 lattice_0.17-15
>
>
> Jean-Louis Abitbol, MD
> Chief Medical Officer
> Trophos SA, Parc scientifique de Luminy, Case 931
> Luminy Biotech Entreprises
> 13288 Marseille Cedex 9 France
> Email: jlabitbol at trophos.com ---- Backup Email: abitbol at sent.com
> Cellular: (33) (0)6 24 47 59 34
> Direct Line: (33) (0)4 91 82 82 73-Switchboard: (33) (0)4 91 82 82 82
> Fax: (33) (0)4 91 82 82 89
>
> ______________________________________________
> 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.
>
--
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
More information about the R-help
mailing list