BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Denali
Quartz | Level 8

Hi, 

 

I ran the below code for 3 seperate univariate logistic regrssion models for 3 time variables with the outcome of death (0 vs. 1). The time variables have hr:min:sec format. Proc contents shows the format is "time". Please see attached dataset "Sample1.xsxl.".

 

proc logistic data=Sample1 descending;
model Death = Culture_TIME;
format Culture_TIME time.;
run;

 

proc logistic data=Sample1 descending;
model Death = Treatment_TIME;
format Treatment_TIME time.;
run;

 

proc logistic data=Sample1 descending;
model Death = Total_TIME;
format Total_TIME time.;
run;

 

However, the 3 odds ratios and 95% CIs are the same 1.00 (1.00-1.00), which makes me wonder if I did something wrong. Could anyone please verify the results for me?

 

Thank you so much!

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Try adding the CLODDS= option to the model statement

 

model Death = Culture_TIME / CLODDS=Wald;

PG

View solution in original post

7 REPLIES 7
ballardw
Super User

1) your attachment didn't attach

2)Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the <> icon or attached as text to show exactly what you have and that we can test code against.

 

You may need to double check the actual values of your "time". Excel does "time" as fractions of a day and depending on the method used to read the data you may need to do some additional conversion, especially if you used proc import to get the data into SAS. If you run proc means on your data and the max value is <1 then you likely have this issue.

One solution might be to make sure the columns in Excel are formatted for time, export to a CSV file and then import that.

 

 

 

When SAS shows the same value as upper and lower bound of an interval it often means there is something related to the format. Formats will round values to display. So if the actual values were something like 0.95 and 1.03 you might see that displayed.

You might try changing the format to something like BEST8. The results should then be displayed in seconds.

 

Denali
Quartz | Level 8

Just uploaded the Excel file. I changed the format to Best8. but I still got 1.00 (1.00-1.00) results.

 

Analysis Variable : Culture_time
N Mean Std Dev Minimum Maximum
161 198537.02 107437.48 45240.00 562200.00

 

The LOGISTIC Procedure
Model Information
Data Set WORK.Sample1  
Response Variable Death Death
Number of Response Levels 2  
Model binary logit  
Optimization Technique Fisher's scoring  


Number of Observations Read 161
Number of Observations Used 161


Response Profile
Ordered
Value
Death Total
Frequency
1 1 46
2 0 115

Probability modeled is Death=1.

 


Model Convergence Status
Convergence criterion (GCONV=1E-8) satisfied.


Model Fit Statistics
Criterion Intercept Only Intercept and
Covariates
AIC 194.643 193.048
SC 197.724 199.211
-2 Log L 192.643 189.048


Testing Global Null Hypothesis: BETA=0
Test Chi-Square DF Pr > ChiSq
Likelihood Ratio 3.5949 1 0.0580
Score 3.7231 1 0.0537
Wald 3.6045 1 0.0576


Analysis of Maximum Likelihood Estimates
Parameter DF Estimate Standard
Error
Wald
Chi-Square
Pr > ChiSq
Intercept 1 -1.5334 0.3782 16.4420 <.0001
Culture_TIME 1 3.007E-6 1.584E-6 3.6045 0.0576


Odds Ratio Estimates
Effect Point Estimate 95% Wald
Confidence Limits
Culture_TIME 1.000 1.000 1.000


Association of Predicted Probabilities and
Observed Responses
Percent Concordant 56.3 Somers' D 0.126
Percent Discordant 43.7 Gamma 0.126
Percent Tied 0.0 Tau-a 0.052
Pairs 5290 c 0.563
PaigeMiller
Diamond | Level 26

If you write the confidence interval for the odds ratio to a SAS data set, you will see that the values are not 1.000 if you display more than three decimal places.

--
Paige Miller
PGStats
Opal | Level 21

The estimated odds ratios are for a 1 second change in time, which is very small compared to the range represented in your data. Use the UNITS statemant to change the time units of your estimates, for example:

 

UNITS culture_time='01:00:00't ;   /* 1 hour time unit */

PG
Denali
Quartz | Level 8

Hi @PGStats ,

 

I added the Units Statement into the code below:

 

proc logistic data=Sample1 descending;
model Death = Culture_TIME;
UNITS Culture_TIME='01:00:00't ; /* 1 hour time unit */
format Culture_TIME BEST8.;
run;

 

Testing Global Null Hypothesis: BETA=0
Test Chi-Square DF Pr > ChiSq
Likelihood Ratio 3.5949 1 0.0580
Score 3.7231 1 0.0537
Wald 3.6045 1 0.0576

Analysis of Maximum Likelihood Estimates
Parameter DF Estimate Standard
Error
Wald
Chi-Square
Pr > ChiSq
Intercept 1 -1.5334 0.3782 16.4420 <.0001
Culture_TIME 1 3.007E-6 1.584E-6 3.6045 0.0576

Odds Ratio Estimates
Effect Point Estimate 95% Wald
Confidence Limits
Culture_TIME 1.000 1.000 1.000

Association of Predicted Probabilities and
Observed Responses
Percent Concordant 56.3 Somers' D 0.126
Percent Discordant 43.7 Gamma 0.126
Percent Tied 0.0 Tau-a 0.052
Pairs 5290 c 0.563

Odds Ratios
Effect Unit Estimate
Culture_TIME 3600.0 1.011

Then I got this OR = 1.011 for unit 3600 seconds. Is there a way to output the 95% C.I. as well?

PGStats
Opal | Level 21

Try adding the CLODDS= option to the model statement

 

model Death = Culture_TIME / CLODDS=Wald;

PG
Denali
Quartz | Level 8

Hi @PGStats ,

It worked!!! Thank you so much!!!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1184 views
  • 2 likes
  • 4 in conversation