BookmarkSubscribeRSS Feed
PQK
Calcite | Level 5 PQK
Calcite | Level 5
I have a data table with 1 variable classified by date. I would like to use a function to change the date format so that it complies with the ISO 8601 calendar week. Example follows:

Date------SAS Format--ISO 8601
2011/1/3--18630-------2011CW0101
2011/1/4--18631-------2011CW0102
2011/1/5--18632-------2011CW0103
2011/1/6--18633-------2011CW0104
2011/1/7--18634-------2011CW0105
2011/1/8--18635-------2011CW0106
2011/1/9--18636-------2011CW0107
(the dashes inserted above are for clarity only)

The above series progresses on until the last day of 2011 calendar year on 01JAN2012, or 2011CW5207.

I searched through the forum and SAS community and couldn’t find any reference to this type of a date/time function.

Any help would be greatly appreciated.
3 REPLIES 3
Patrick
Opal | Level 21
Hi

The following link gives you the overview over SAS existing ISO8601 formats: http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a003169814.htm

If this is not enough then you have always the possibility to create your own picture format:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473467.htm

HTH
Patrick
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Start by looking at the WEEKV format.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic / post:

iso 8601 calendar week date format site:sas.com

weekv format site:sas.com
PQK
Calcite | Level 5 PQK
Calcite | Level 5
Patrick & sbb,

Thank you very much for the replies!

THe WEEKV format suggestion put me in the right direction. In combination with the WEEK(date,'v') function I was able to display dates and sum quantities based on the Mon - Sun calendar week system.

Best Regards,

PDK

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1343 views
  • 0 likes
  • 3 in conversation