I find it very frustrating when I forget how to do something in SAS that I know I have done before.
In these times of frustration I type into a Google search bar “SAS how do you do this” and am surprised by how complex all the results you get are. While a lot of the support documents and help guides are very useful and thorough, sometimes I just want to see how you use the function or Proc in simple code and don’t have time to read some of the larger documents.That is why I shall be blogging simple SAS guides for often used and sometimes frustrating code problems.
SAS Dates seems like a good place to start.
SAS Date format conversion basics:
- Each unformatted field in a SAS table can be either a number (Blue circle) or Text (red Triangle)
- When working with Dates in SAS you first want to make sure SAS is reading your date as a SAS date.
- SAS Dates are a number representing the number of days since 01Jan1960. So 1 is 02Jan1960 and 365 is 31st Dec1960.
- To convert a numeric field into a sas date use a combination of input and Put, to convert a text field into a SAS date use input.
- A SAS date in raw form will be a 5 digit number (between 1987 to 2233) but when formatted as a date will show a calendar icon
How to use in code:
DatetoText = put(mydate,format)
Numbertodate = input(put(mydate,format),informat);
- The informat is the format of the field that you are reading in.
- This code will work in both code nodes and wizard nodes (such as the query node)
For a list of SAS Informats go here
For a list of SAS Date Formats go here
P.s While there are many ways of doing anything in SAS the above ways are my preferred way
I have been doing some research on cool and advanced ways of visualising large volumes of data and content.
Stumbled across a Technology called WebGL and a few interesting examples.
Once you have finished playing with it, close your eyes.
Imagine if you used this technique to list all the reports available in your BI environment.
Imagine if the browse feature allowed you to view them by subject area (Finance, HR etc) or key master business entity (Customer, Product, Service etc).
Imagine how easy your users would find it to find answers to the questions they have (which i'm guessing was the one of the core business value statements in your BI investment business case).
Now imagine your users seeing this and then going back to that list of reports you make them choose (guess) via that drop down menu or list in the portal.
How do you feel?
(isnt it amazing the power of visualisation