BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11

I have this code and I wonder what other %b-%y do?

what about picture?

 

proc format;
picture fmt (default=6)
other=%b-%y (datatype = date);
run;

Regards,

blueblue

 

Blue Blue
6 REPLIES 6
Reeza
Super User

Nothing in the documentation?

 


@GN0001 wrote:

I have this code and I wonder what other %b-%y do?

what about picture?

 

proc format;
picture fmt (default=6)
other=%b-%y (datatype = date);
run;

Regards,

blueblue

 


 

GN0001
Barite | Level 11

Hello Reza,

I couldn't find this documentation and it is not easy to understand what I am looking for. Many explanations and details about things that I don't need.

 

The documentation helped me to the extent that I can use the picture statement if I want.

 

Regards,

blueblue

Blue Blue
Tom
Super User Tom
Super User

The OTHER is a special range that means all values not assigned to other "pictures".

The %b and %y have special meaning when the values be formatted are treated as date values (number of days since start of 1960).

To find the documentation look for the PROC FORMAT PICTURE statement and that will lead you to the discussion on the what the special directives in the "picture" mean.

 

PS  You are missing quotes in your definition.  PROC FORMAT will except that to maintain backwards compatibility.  But since the directive used include the % character that is also use by the macro processor you should place the "picture" string in single quotes to prevent the macro processor from trying to call macros named B or Y.

proc format;
picture fmt (default=6)
  other='%b-%y' (datatype = date)
;
run;
GN0001
Barite | Level 11

Hello,

What does this mea: all values not assigned to other "pictures"?

regards

blue

Blue Blue
Kurt_Bremser
Super User

@GN0001 wrote:

Hello,

What does this mea: all values not assigned to other "pictures"?

regards

blue


In the format definition, you use ranges and assign a picture to them. All values not fitting one of the ranges will be treated by the picture in the OTHER range.

Using only one OTHER range means that this picture will be used for all values.

ballardw
Super User

Personally I recommend using a 4-digit year, %Y, instead of 2-digit %y.

Are you  100 percent sure that every person that sees a result of Jan-21 in your output will know that the 21 is supposed to be a Year?

Are you sure that the same or associated documents that might be used along with the output in never write Jan-21 to mean the 21st day of January?

 

If you cannot answer Yes to both of those questions with certainty then remove any possible confusion and use 4 digits.

 

(Y2K anyone?)

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 987 views
  • 4 likes
  • 5 in conversation