All I am trying to verify Microsoft R Client output from a logistic regression model with SAS. The dependent variable (yBinom2) has all values == 0 intentionally (and is realistic my area of work -- e.g., all technologists do not see red blood cells in a normal urine sample). Simulated data are below and attached (delimiter = "|"). When I run the regression model in R, estimation completes (code and output below for logit link function). When run in SAS with the logit link function, I receive the error message "All observations have the same response." I am most interested in the predicted probabilities for each sample id. Does anyone know why the SAS solution will not estimate? Are there options in SAS to handle the scenario where the dependent variable has all 0's or 1's? Thank you in advance. simulated data set: sampleNo y x yBinom1 yBinom2 yBinom3 1 6.68 6.92 1 0 1 2 6.75 6.66 0 0 1 3 6.85 6.93 1 0 1 4 6.86 6.98 1 0 1 5 6.67 6.95 1 0 1 6 6.96 6.69 1 0 1 7 6.91 6.55 0 0 1 8 6.82 6.87 1 0 1 9 6.55 6.81 0 0 1 10 6.87 6.75 1 0 1 11 6.52 6.94 0 0 1 12 6.59 6.79 0 0 1 13 6.6 6.87 1 0 1 14 6.56 6.68 0 0 1 15 6.65 6.53 1 0 1 16 6.68 6.88 0 0 1 17 6.64 6.91 0 0 1 18 6.96 6.99 0 0 1 19 6.9 6.83 1 0 1 20 6.6 6.91 0 0 1 R code: A <- read.csv("C:/Users/BodnarJ/Desktop/functionalRequirement4_9_X/dataSim_FR_4_9_X.csv", sep = "|", header = TRUE, colClasses="character") for(j in 2:ncol(A)){ A[,j] <- as.numeric(A[,j]) } ###################################################################### ###################################################################### # binomial logistic regression model vv <- A logitMod <- glm( yBinom2 ~ x , data=vv , family=binomial(link="logit")) predicted <- plogis(predict(logitMod, vv)) # predicted scores vv$prob <- predicted vv$probFlag <- ifelse(vv$prob > 0.5 , 1 , 0) vv$resid <- logitMod$residuals print( vv , row.names = F) R Output: sampleNo y x yBinom1 yBinom2 yBinom3 prob probFlag resid 1 6.68 6.92 1 0 1 7.884924e-12 0 -1 2 6.75 6.66 0 0 1 7.884924e-12 0 -1 3 6.85 6.93 1 0 1 7.884924e-12 0 -1 4 6.86 6.98 1 0 1 7.884924e-12 0 -1 5 6.67 6.95 1 0 1 7.884924e-12 0 -1 6 6.96 6.69 1 0 1 7.884924e-12 0 -1 7 6.91 6.55 0 0 1 7.884924e-12 0 -1 8 6.82 6.87 1 0 1 7.884924e-12 0 -1 9 6.55 6.81 0 0 1 7.884924e-12 0 -1 10 6.87 6.75 1 0 1 7.884924e-12 0 -1 11 6.52 6.94 0 0 1 7.884924e-12 0 -1 12 6.59 6.79 0 0 1 7.884924e-12 0 -1 13 6.60 6.87 1 0 1 7.884924e-12 0 -1 14 6.56 6.68 0 0 1 7.884924e-12 0 -1 15 6.65 6.53 1 0 1 7.884924e-12 0 -1 16 6.68 6.88 0 0 1 7.884924e-12 0 -1 17 6.64 6.91 0 0 1 7.884924e-12 0 -1 18 6.96 6.99 0 0 1 7.884924e-12 0 -1 19 6.90 6.83 1 0 1 7.884924e-12 0 -1 20 6.60 6.91 0 0 1 7.884924e-12 0 -1 SAS Code: proc import datafile="C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv" dbms=csv out=work.anaDS replace; delimiter="|"; getnames=yes; guessingrows=7000; run; proc logistic data = anaDS ; model yBinom2 = x / LINK = logit; run; SAS Log: 748 proc import datafile="C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv" 748! dbms=csv out=work.anaDS replace; 749 delimiter="|"; 750 getnames=yes; 751 guessingrows=7000; 752 run; 753 /********************************************************************** 754 * PRODUCT: SAS 755 * VERSION: 9.4 756 * CREATOR: External File Interface 757 * DATE: 05AUG18 758 * DESC: Generated SAS Datastep Code 759 * TEMPLATE SOURCE: (None Specified.) 760 ***********************************************************************/ 761 data WORK.ANADS ; 762 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 763 infile 'C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv' delimiter = 763! '|' MISSOVER DSD lrecl=32767 firstobs=2 ; 764 informat sampleNo best32. ; 765 informat y best32. ; 766 informat x best32. ; 767 informat yBinom1 best32. ; 768 informat yBinom2 best32. ; 769 informat yBinom3 best32. ; 770 format sampleNo best12. ; 771 format y best12. ; 772 format x best12. ; 773 format yBinom1 best12. ; 774 format yBinom2 best12. ; 775 format yBinom3 best12. ; 776 input 777 sampleNo 778 y 779 x 780 yBinom1 781 yBinom2 782 yBinom3 783 ; 784 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ 785 run; NOTE: The infile 'C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv' is: Filename=C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv, RECFM=V,LRECL=32767,File Size (bytes)=438, Last Modified=05Aug2018:08:39:09, Create Time=05Aug2018:08:26:59 NOTE: 20 records were read from the infile 'C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv'. The minimum record length was 17. The maximum record length was 18. NOTE: The data set WORK.ANADS has 20 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 0.05 seconds cpu time 0.03 seconds 20 rows created in WORK.ANADS from C:\Users\BodnarJ\Desktop\functionalRequirement4_9_X\dataSim_FR_4_9_X.csv. NOTE: WORK.ANADS data set was successfully created. NOTE: The data set WORK.ANADS has 20 observations and 6 variables. NOTE: PROCEDURE IMPORT used (Total process time): real time 0.13 seconds cpu time 0.06 seconds 786 787 proc logistic data = anaDS ; 788 model yBinom2 = x / LINK = logit; 789 run; ERROR: All observations have the same response. No statistics are computed. NOTE: The SAS System stopped processing this step because of errors. NOTE: There were 20 observations read from the data set WORK.ANADS. NOTE: PROCEDURE LOGISTIC used (Total process time): real time 0.02 seconds cpu time 0.01 seconds
... View more