anyone familiar with ccyymmdd format?
I am supposed to convert today's date using the above format but not working
Yes. 'CCYYMMDD' is NOT a SAS FORMAT. It is someone's idea of a mnemonic way of describing the way that they want the date to display.
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
thanks admin
will take a look shrtly
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:
data want;
x=today();
format x yymmddN8. ;
run;
proc print; run;
so ccyy is actually the current year,right?
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.
data _null_;
today=date();
today_str = put(today,yymmddn8.);
today_num = input(today_str,8.);
put today=
/ today= date9.
/ today_str=
/ today_str= $quote.
/ today_num=
/ today_num = comma10.
;
run;
today=19983
today=17SEP2014
today_str=20140917
today_str="20140917"
today_num=20140917
today_num=20,140,917
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?
Yes. 'CCYYMMDD' is NOT a SAS FORMAT. It is someone's idea of a mnemonic way of describing the way that they want the date to display.
Thanks
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.