I've been asked to read the SAS dataset in an ASP.Net application. This dataset contains the date variable as well as the variables with user-defined formats. These variables is displayed in the numeric format in the grid columns. How to display the SAS formats that assigned to the SAS dataset?
1
votes
How are you displaying it right now - without formats? What code are you using?
– Allan Bowe
The returned data doesn't have any of SAS formats applied. E.g. the date variable is displayed as a numeric variable. I use C# to read the SAS dataset in the ADODB recorset. I found that I should use a a Format Service workspace utilities to apply SAs formats to the data returned. Does anyone have an example of the code?
– user2996895
Thanks. I got the answer from the SAS support.
– user2996895
could you post the answer?
– Allan Bowe
1 Answers
0
votes
In order to have the formats applied you should:
- Open Connection object
- Create a custom property for this connection object (SAS Formats) that tells ADO how to deal with SAS formats (obRecordset.Properties("SAS Formats")="ALL")
- Assign a libref for the format catalog
See the answer on the page 92-96 "Reading User-Defined SAS Formats and Informat" section of the SAS 9.3 Providers for OLE DB Cookbook