I recently taught a SAS training course where the students were very engaged. They had so many questions, I could have spent the next month writing helpful blog posts that came from that one class. However, I picked this one question that the class begged for me to share. The students were so keen on the answer, they even let me take a photo of them smiling as they did yoga. Fair trade. Yoga poses in exchange for a SAS tip. (By the way, I’m also a yoga instructor.)

Problem – Rachel gets dates in a date time format. Her team has been going through a laborious process of copying into Excel and extracting and then converting to a SAS date. Can she do this with SAS?

Solution – Yes, of course. (You knew that was the answer!) SAS can do practically anything, but SAS takes special pride in reading virtually any data. Flat files, text files, .csv, .dat, -- no problem at all.

Here is the step-by-step code:

Step 1 - Create a data set with dates in text format stored as yyyymmdd hh:mm:ss

Step 2 - Read in the datetime value using the right informat.

Remember informats provide instructions on how to read in raw data. In this problem, the informat ymddttm. reads in the text date value and converts to a SAS date time value. It returns the number of seconds since midnight of January 1, 1960. Number of seconds is not what this user wanted. After conversion, use the datepart function to pull out the date portion of the date, so that you can use the many SAS functions to manipulate your SAS date value.

/*condate is a SAS date time value. it is stored as #of seconds since midnight, 1Jan1960*/
/*pulldays uses the datepart function so you have SAS date value in #of days since 1Jan1960*/

Step 3 - Apply a format to converted date to confirm that the conversion is accurate

Hope you enjoyed this tip, plus the smiling class. Amazing things can happen when you come take a SAS course. You learn a lot, and you have fun.

Now onto the biggest challenge that I’m posing to you, dear reader.

This week, I’m starting a 21-day SAS challenge. I decided to create the challenge  after getting inundated with resumes and requests for advice ever since my "How to land a job as a SAS professional" blog posted. I want to let everyone know that I don’t have the answer to your dream SAS job-- but you do. I also know how intimidating a job search can be, and how easy it is to lapse into nothingness as it looks too daunting. So I’m supporting the group members and guiding them to break down the work one day at a time.

My 21-day SAS challenge starts June 6, 2015. Every day I’ll post a mini challenge to complete.

Here’s an example of the kind of challenges I’ll be posting:

Sample challenge – Create good karma (join a SAS Users Group-karma points for joining and attending)

It’s survival of the fittest (not my quote, just nature’s law ). If you’re committed to doing the work and getting fit, you will be in a good position to finding your SAS job.

This challenge is open to anyone, living anywhere, who wants to find their dream SAS job. It's easy to do with small daily actions. Just join this LinkedIn group if you are ready for the 21-day SAS challenge.

Share

Technical Training Specialist

Charu Shankar has been a Technical Training Specialist with SAS since 2007. She started as a programmer, and has taught computer languages, business and English Language skills. At SAS, Charu teaches the SAS language, SQL, SAS Enterprise guide and Business Intelligence. She interviews clients to recommend the right SAS training to help them meet their needs. She is helping build a center for special needs kids in this project. http://www.handicareintl.org/pankaja/pankaja.swf