Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: support for writing "notes" to .dta files #712

Open
mafw opened this issue Feb 14, 2023 · 1 comment
Open

Feature request: support for writing "notes" to .dta files #712

mafw opened this issue Feb 14, 2023 · 1 comment
Labels
feature a feature request or enhancement

Comments

@mafw
Copy link

mafw commented Feb 14, 2023

haven::read_dta has the ability to read “notes” from ".dta" files produced by STATA. haven::write_dta can write .dta files with a "label" attribute for the data set that STATA users can see when they load the data.

It would be great if haven:write_dta could write the value stored in an attribute named "notes" to the .dta file. In Stata, the "notes" attribute can contain more characters than the "label" attribute, so I find it more useful. For example, I would like to include a link to the source of the raw data in a file that contains the processed data.

It appears that this functionality is working in the underlying ReadStat package.

@gorcha gorcha added the feature a feature request or enhancement label Feb 14, 2023
@mafw
Copy link
Author

mafw commented Jul 30, 2024

For reference, the functionality was added in the following commit in the ReadStat repo:

44eff95

Documented in this issue:

WizardMac/ReadStat#73

Seems like the function readstat_add_note can be used to add notes to datafiles when saving them. I've tried figuring out how to implement this functionality into the haven package, but since I have no experience with implementing C code in R packages I haven't gotten very far...

Also, a workaround to get save .dta files with notes mentioned in an issue for the ReadStata13 package here:

sjewo/readstata13#77 (comment)

It works when saving .dta files using readstata13::save.dta13, but not haven::write_dta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants