09-17-2014 04:09 PM
Hi.. I moved your quesiton to the Procedures community so more people will see your question. I also did a search on ccyymmdd and found a few threads with answers. Does this one help? https://communities.sas.com/message/132225#132225
09-17-2014 06:17 PM
In SAS if you have a date variable then the equivalent format is yymmddN8.
The CC or century will show up with most SAS formats when the field is wide enough to provide a 4 digit year.
In a data step:
format x yymmddN8. ;
proc print; run;
09-17-2014 08:33 PM
CCYY is notation for a four digit year CC is the century (currently 21) and YY are the last two digits of the year.
If you want today's date then use the DATE() function. (You can also call the same function using the name TODAY() instead).
This will return the current date as the number days since beginning of 1960. You can then use the PUT() function to apply a FORMAT to the value to convert that into the 8 digit string that you want. If you want that string of digits converted to a number you can use an INPUT() function.
today_str = put(today,yymmddn8.);
today_num = input(today_str,8.);
/ today= date9.
/ today_str= $quote.
/ today_num = comma10.
09-17-2014 08:52 PM
Im actually supposed to show today's date using this format ccyymmdd so if y=today() after trying format y ccyymmdd. I was not getting anything. So I should do format y yymmdd8. then?
Need further help from the community? Please ask a new question.