DATA Step, Macro, Functions and more

Doing a CALC on two date fields and using DATEPART

Reply
Contributor
Posts: 35

Doing a CALC on two date fields and using DATEPART

I am getting (.) in my results, now I know this has something to do with the date and creating a numeric value.

 

How do I get rid of the (.)?  I am using the SAS Plug in for excel and this is giving me fits when I go to use a Pivot. 

 

I would rather if there is no value to just leave it blank.

 

here is the partial code:

 

AVG(DATEPART(S.On_Block_Dt) - DATEPART(S.Title_Rcvd_Dt)) AS Title_Received_to_On_Block,

AVG(DATEPART(S.Sale_Date) - DATEPART(S.Title_Rcvd_Dt)) AS Title_Received_to_Sold,

AVG(DATEPART(S.Title_Rcvd_Dt) - DATEPART(S.Secured_Dt)) AS Secured_to_Title_Received,

AVG(DATEPART(S.Assigned_Dt) - DATEPART(S.Grounding_Dt)) AS Grounded_to_Assigned,

 

I am using PROC SQL to do this.

 

 

Super User
Posts: 19,780

Re: Doing a CALC on two date fields and using DATEPART

Posted in reply to TMiller16

Missing is a period for numerics, not a blank. Even if you add in conditional logic to not calculate the value, it would still be missing and a period.

 

Since you're doing an average or summarization I'm suprised you're ending up with missing, unless what happens is, if you have any value missing it's being set to missing. Or you're missing a lot of data.

Respected Advisor
Posts: 4,920

Re: Doing a CALC on two date fields and using DATEPART

Posted in reply to TMiller16

Try using option missing=' '; before writing to Excel.

PG
Ask a Question
Discussion stats
  • 2 replies
  • 126 views
  • 0 likes
  • 3 in conversation