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
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
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
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;
Hello,
What does this mea: all values not assigned to other "pictures"?
regards
blue
@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.
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.