09-05-2013 02:30 PM
I am trying to create a list of variables in my dataset and separte them in 3 categories.
CHARACTER, NUMERIC and DATE.
I am using dictionary.columns to get the variables. I can easily get the character and numeric but the problem with numeric is that the date variable is also of type numeric and I want them separated.
Is there an easy way to separate date variables from numeric?
BTW i tried to make use of format as well but as you know there could be any kind of date format. I am hoping there is an easy and clever way of doing this.
Any help is appreciated.
09-05-2013 02:56 PM
As you already concluded, there is no specific data type for dates in SAS.
So, there is no bullet proof way.
You could, as you mentioned, try to look at different attributes, and then guess if it's a date column. Format is one, naming another. You could also look at the contents in the columns to see if they have normal data values (10s of thousands).
I don't know anything about your application, but when building systems/databases, naming conventions are crucial so users can easily understand the contents of tables and columns.
09-08-2013 08:49 AM
SAS9.4 allows us to add extended variable and table attributes.
See PROC DATASETS Example 12 Extended Attributes at http://support.sas.com/documentation/cdl/en/proc/64787/HTML/default/n1fi5duus5pm9xn1csr0vzaccytt.htm
09-08-2013 10:08 AM
When you are using Eguide is will be a client/server approach.
The Server can be your local desktop but a lot of power will come from servers and the most proposed ones are Unix based (Linux redhat suse and Aix). You can recognize that if you need to define a profile to reach a server. Workspace Servers are just one type of objects that can be defined.
SAS libraries and data elements can also be defined and redefined. That redefining can be done witht Information map studio.
That manual is showing some of what is done.
SAS(R) Information Map Studio 4.2: Getting Started with SAS(R) Information Maps (Creating Data Items) is showing dates being defned as types. They are still numeric as it is normal SAS on the backgound there.
Going into details you can add descriptions to elements. In DI is something found for it.
SAS(R) Data Integration Studio 4.7: User's Guide (Add a Note or Document to a Registered Object)
It are the tools for modeling describing the data. There are interfaces to other tools doing this in the same way .
With these descritpions new code can be generated. Not coding by hand but defining relationships with transformations.
By that the metdatabase will become something containing information in a similar way as you would do change-management to source-code.
The fun of this approach is that when it is complete you can easily have and use tools for analysing impacts in those relations and logic.
SAS(R) Data Integration Studio 4.7: User's Guide (impact analysis)
09-08-2013 07:19 AM
In future XATTR could be used to added the DATE attribute when the data set is defined.
As mentioned the format should help and there aren't so many that you can't figure it out.
When you get it figured make the INFORMAT for the DATE variables DATE9. Unless you have v9.4 and can use XATTR.