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

SAS dataset (.sas7bdat) label. Please retain it with read_sas() #492

Closed
ghost opened this issue Jan 23, 2020 · 1 comment
Closed

SAS dataset (.sas7bdat) label. Please retain it with read_sas() #492

ghost opened this issue Jan 23, 2020 · 1 comment
Labels
feature a feature request or enhancement

Comments

@ghost
Copy link

ghost commented Jan 23, 2020

Dear developer,

When SAS dataset (.sas7bdat) has a label then it is not preserved while using read_sas(). Could you please add this feature to retain dataset label? I attached the dataset and I had to change the extension to .txt otherwise GitHub won't attach. Please change the extension to .sas7bdat for your testing.

data1.txt

/*example in SAS*/


data OUTDATA.data1 (label='This is a data1 label');
 x=1;
 run;
 
data OUTDATA.data2 (label='This is a data2 label');
 x=1;
 run;

proc sql noprint;
   create table labels as
   select memname, memlabel
   from dictionary.tables
   where libname='OUTDATA'
   ;
run;

proc print data = labels;
run;

/*the output is*/
/*
             Obs    MEMNAME              MEMLABEL

                 1     DATA1          This is a data1 label
                 2     DATA2          This is a data2 label           

*/
# when reading with haven::read_sas() the dataset label is gone. the dataset data1.sas7bdat is attached

zz <- haven::read_sas("/entimice/data1.sas7bdat")
str(zz)

# The output is 
# > zz <- haven::read_sas("/entimice/data1.sas7bdat") 
# > str(zz) 
# Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	1 obs. of  1 variable:  
# $ X: num 1  - attr(*, "label")= chr "DATA1"
@hadley hadley added the feature a feature request or enhancement label Apr 20, 2020
@evanmiller
Copy link
Collaborator

This is being worked on, see here: WizardMac/ReadStat#213

@hadley hadley closed this as completed Apr 8, 2021
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