I need SAS Code that does the following:
1. Checks if selected columns are in fact in the Data Table
2. Checks if above columns are in certain formats
3. Checks if the data in the above columns are usable
4. If the table fails any of these tests, an detailed error should be given and the process must be stopped.
I'm adding this code to "Idiot Proof" our current SAS Macros. I have no idea where to start...
Another possibility is to use data step functions to query the table directly.
For point 4 I guess you are into some extensive if-then logic, where you combine the type of error (point 1-3) with the information retrieved by point 3 together with original information you got (table/column name etc).
The dictionary tables already exist. You don't necessarily need to create an output data set from PROC CONTENTS. If you search previous forum postings for "dictionary.tables" and "dictionary.columns", you should find some other examples.
create table structure as
select libname, memname, name, type, length,
format, informat, label
where libname = 'SASHELP' and
memname = 'SHOES';
memname : contains tablename
name : contains variablename
type : contains variable type (1 for numeric, 2 for character)
length : contains length
format : contains formatname
formatl : contains format length
formatd : contains number of digits post decimal