SAS Transport Files and .NET

This post was kindly contributed by SAS from Out in Left Field - go there to comment and to read the full post.

Well, someone contacted me about the Data Management Utilities. they loved them (thank you) but wanted to know about reading SAS Transport Files. Well, after fiddling with the localProvider a bit and getting nowhere, I stumbled onto something cool:

  • Download and install the SAS Universal Viewer from the SAS support site
  • Create a new project in Visual Studio
  • Add a reference from the SAS Universal Viewer install files to the following 2 dlls
  •    SAS.UV.Transport
  •    SAS.UV.Utility
  • Use the following C# code (adapt as needed):
TransportFile tf = new TransportFile(@"x:\temp\sample.xpt");
var x = tf.Datasets;

Your dataset will be in variable x

Don’t forget to add the using statement to the top of your code for the SAS.UV.

This post was kindly contributed by SAS from Out in Left Field - go there to comment and to read the full post.