DATA Step, Macro, Functions and more

if blank then add system date

Reply
Contributor
Posts: 30

if blank then add system date

[ Edited ]

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

Super User
Posts: 10,279

Re: if balnk then add system date

Posted in reply to ashishj816
if datefield = . then datefield = date();
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor
Posts: 30

Re: if balnk then add system date

Posted in reply to KurtBremser

but It gives me sas date

Super User
Posts: 10,279

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
How to convert datasets to data steps
How to post code
Super User
Posts: 23,773

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
  • 424 views
  • 0 likes
  • 3 in conversation