I am looking for general guidance, references or specific suggestion on how I can see SAS formatted values in ORACLE.
The SOURCE dataset has many variables with numeric codes. In SAS each of these variables has a format that translates CODES to meaningful VALUES. Some users of this dataset don't have access to SAS. They view the data in ORACLE. All they see in ORACLE is coded values which are difficult to understand without formatted values.
How do I approach adding formatted values to ORACLE?
I've been thinking about creating an SQL VIEW script in ORACLE. Duplicating the dataset with formatted values does not seem reasonable. Any suggestions on how to automate the creation of this view? Obviously, I have a SAS format catalog with CODE to VALUE mapping for each variable. In ORACLE there is also a simple lookup data table with the following columns: VariableName, CodeValue, and FormattedValue. Here's a sample of the LOOKUP:
VariableName CodeValue FormattedValue
Sex 1 Male
Sex 2 Female
Race 1 White
Race 2 Black
Race 3 Asian
I could write separate joins with (where=(VariableName='XXX')) linking each variable in the source dataset to the LOOKUP but that seems terribly inefficient. There are about 100 variables to be labeled. Here's an example of what I am trying to avoid:
create view Source_V as
select ID,
Sex, sx.FormattedValue as Sex_VAL,
Race, r.FormattedValue as Race_VAL
from Source s
left join LookUp(where=(VariableName='Sex')) sx ON s.Sex=sx.CodeValue
left join LookUp(where=(VariableName='Race')) r ON s.Sex=r.CodeValue
I don't even know if ORACLE will understand the WHERE clause. I may need to write an entire sub-query for each joint.
Appreciate any guidance.
... View more