GithubHelp home page GithubHelp logo

Comments (5)

gorcha avatar gorcha commented on June 12, 2024 2

Hi @kaz462 and @ynsec37,

Thanks for the feedback! This is an issue with our dataset label validation code, and the documentation could be clearer - the dataset label for XPT files is a maximum of 40 bytes rather than characters. Our validation code is currently checking with the default type = "chars" and should be updated to type = "bytes".

@ynsec37 note that the XPT documentation shared above is referring to the variable label length. Although variable labels can be longer in version 8 the maximum dataset label length is still 40 bytes.

from haven.

ynsec37 avatar ynsec37 commented on June 12, 2024 1

Hi @botsp It seems that write_xpt() may only support the xpt creation.

write_sas() creates sas7bdat files. Unfortunately the SAS file format is complex and undocumented, so write_sas() is unreliable and in most cases SAS will not read files that it produces.
write_xpt() writes files in the open SAS transport format, which has limitations but will be reliably read by SAS.

For sas7bdat, I use the same way you mentioned, that is creating the xpt first by R then coverting to sas7bdat by SAS.
After converting, I compared results from write_xpt() with SAS datasets directly created by SAS, there is no difference except the variable length.

from haven.

ynsec37 avatar ynsec37 commented on June 12, 2024

Dear developer,

I found that the label length that must be <= 40 is just used for the xpt 5, if the version = 8 the label should be up to 256.

sas xpt version 5

image

sas xpt version 8

image

from haven.

botsp avatar botsp commented on June 12, 2024

Hi both, May I confirm a question about data conversion.
I am trying to convert the *.rda file to *.sas7bdat, and it seems the "write_xpt" doesn't work as expected. The created sas7bdat file cannot be opened, it always shows "file ... is not a SAS data set".

  • write_xpt(my_dataset, "P:/Kevin/CDISC_DataFromR/Pharmaverse/Adam/my_sasdsy.sas7bdat") *

I saw some discussion about this issue and doesn't found a good solution.

  1. What is the recommended method for converting the *.rda file to a *.sas7bdat file?

  2. It seems that "write_xpt" works well when converting to an *.xpt file. Should I first convert the file to an xpt format and then change it to a *.sas7bdat file using SAS? Are there any potential risks associated with this approach?

Looking forward to leanring the insights from your valuable experience. Many thanks!

from haven.

botsp avatar botsp commented on June 12, 2024

Thanks for your explanation and this inspire me about the method of sas data conversion. Thank you!

from haven.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.