Proc Format Issue

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

Proc Format Issue

Hello,

 

I have a sas variable which is only populated with a date in a certain circumstances (for example when a customer misses a payment) otherwise it is missing. Similar to every other date in this dataset (all these dont have missing values though) I wanted it in the below format:

 

proc format;
picture MyMSdt other='%0Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;

 

When I use the format function to allocate my created format to this date all the observations with missing values are populated with ERROR. The variables which are populated show the results I want. How do I stop the missing ones showing ERROR?

 

I hope this makes sense.

 

 


Accepted Solutions
Solution
‎05-04-2016 10:04 AM
SAS Super FREQ
Posts: 676

Re: Proc Format Issue

Change your definition to

proc format;
  picture MyMSdt
    low-high='%0Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;

Bruno

View solution in original post


All Replies
Super Contributor
Posts: 305

Re: Proc Format Issue

Hello,

 

proc format;
picture MyMSdt
.=.
other='%0Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;

Respected Advisor
Posts: 4,972

Re: Proc Format Issue

I think having the format define missing values is the right approach.  Since this is a picture format, you may need to use:

 

. = ' ' (noedit)

Solution
‎05-04-2016 10:04 AM
SAS Super FREQ
Posts: 676

Re: Proc Format Issue

Change your definition to

proc format;
  picture MyMSdt
    low-high='%0Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;

Bruno

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 293 views
  • 4 likes
  • 4 in conversation