You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R version 4.4.1 (2024-06-14 ucrt) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64
I tried to paste the issue in this comment box, but it mangled the text. If interested see github
INPUT
=====
CHR ISMISSING
a 0
1
b 0
1
options validvarname=upcase;
libname sd1 "d:/sd1";
data sd1.have ;
input chr $1.;
ismissing=missing(chr);
cards4;
a
.
b
.
;;;;
run;quit;
Greate Package.
Issue with: Converting imported sas character missings to r missing values using haven package
CONTENTS
github (for a beeter view)
https://tinyurl.com/5cxkxfz2
https://github.com/rogerjdeangelis/utl-converting-imported-sas-character-missings-to-r-missing-values-using-haven-package
R version 4.4.1 (2024-06-14 ucrt) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64
I tried to paste the issue in this comment box, but it mangled the text. If interested see github
CHR ISMISSING
a 0
1
b 0
1
options validvarname=upcase;
libname sd1 "d:/sd1";
data sd1.have ;
input chr $1.;
ismissing=missing(chr);
cards4;
a
.
b
.
;;;;
run;quit;
1 ISSUE
%utl_rbeginx;
parmcards4;
library(haven)
library(dplyr)
have<-read_sas("d:/sd1/have.sas7bdat")
have$R_MISSING<-is.na(have$CHR)
print(have)
str(have)
;;;;
%utl_rendx;
2 CORRECTION
%utl_rbeginx;
parmcards4;
library(haven)
library(dplyr)
have<-read_sas("d:/sd1/have.sas7bdat")
%>% mutate(across(where(is.character)
,~na_if(.,"")))
have$R_MISSING<-is.na(have$CHR)
print(have)
str(have)
;;;;
%utl_rendx;
R DOES NOT HONOR SAS MISSING
CHR ISMISSING R_MISSING
========= =========
1 "a" 0 FALSE
2 "" 1 FALSE WRONG
3 "b" 0 FALSE
4 "" 1 FALSE WRONG
CHR ISMISSING R_MISSING
========= =========
a 0 FALSE
1 TRUE CORRECTED
b 0 FALSE
1 TRUE CORRECTED
RUNNING IN SAS GUI
LOG (DOSE RUN IN R GUI_
A tibble: 4 × 3
CHR ISMISSING R_MISSING
1 "a" 0 FALSE
2 "" 1 FALSE
3 "b" 0 FALSE
4 "" 1 FALSE
The text was updated successfully, but these errors were encountered: