Hi friends!
This newbie sure is anxious to know how to find out and apply the correct format available for Date(s)/Numbers. Sure would appreciate if any of you experts could help by referring some rich source of info in this regard to find ALL the options available and way to use the same.
For instance how to apply date formats in PROC SQL like:
Select DOB, UserName from Work.TempTable
where DOB represents the Date of Birth desired to be returned in the format MMMM DD, YYYY i.e. with full month's name and days in two digits like August 08, 1976.
Thanx in advance.
What you would be needing is worddate. format,
data have;
DOB='08aug1976'd;
run;
proc sql;
select DOB format=worddate20. from have;quit;
Here is the link for all the SAS 9.3 format:
SAS(R) 9.3 Formats and Informats: Reference
HTH,
Haikuo
What you would be needing is worddate. format,
data have;
DOB='08aug1976'd;
run;
proc sql;
select DOB format=worddate20. from have;quit;
Here is the link for all the SAS 9.3 format:
SAS(R) 9.3 Formats and Informats: Reference
HTH,
Haikuo
Fabulous reference for sure buddy!
Thanx again!
A book I have found useful is
The essential guide to SAS Dates and Times
Art Carpenter's SAS software series by Derek P. Morgan
It does not, however, cover many other numeric formats like hex, binary, etc. as you can see by the books' name.
The date format you are looking for to output full month day, year could be built with a picture statement in proc format or with the existing WORDDATEw. format. It's backdraw is that it adds leading blanks to shorter month names.
WORDDATE18. is the minimum width to get full month name parsed, with necessary leading blanks for all but september. Anything below 18 will cut to 3letter abbreviation. Anything beyond 18 will add however much more leading blanks.
I'm not sure of any detailed way to gather information on all format from within SAS (like one you could query and do manipulation to document another dataset with). There's always sashelp.vformat but there are no description of the formats so it is not the most useful dictionary table.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.