DATA Step, Macro, Functions and more

if blank then add system date

Reply
Occasional Contributor
Posts: 14

if blank then add system date

[ Edited ]

wherever there is blank date i wnat to  put today's system date

Super User
Posts: 7,866

Re: if balnk then add system date

Posted in reply to ashishj816
if datefield = . then datefield = date();
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 14

Re: if balnk then add system date

Posted in reply to KurtBremser

but It gives me sas date

Super User
Posts: 7,866

Re: if balnk then add system date

Posted in reply to ashishj816

Of course, as intended. Dates are dates, and the SAS DATE function returns the current date as supplied by the operating system.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 19,878

Re: if blank then add system date

Posted in reply to ashishj816

Since you say blank I'm going to assume you have a character value? Or is it numeric?

 

And if character what format is applied, ie how does it look 01Jan2016 or 01/01/2016?

Ask a Question
Discussion stats
  • 4 replies
  • 388 views
  • 0 likes
  • 3 in conversation