0
votes

I have a C# application that reads data from a MS SQL Server database. What I need to do is to create a class that

  • recovers data from certain views on the database
  • writes the data to files which are in a SAS-readable format

In other words : I need to produce a .SAS7BDAT file from a DataTable inside C# which contains data from a SQL Server database.

Can anyone help? Thanks

1
Nope, not clear. I'm not sure what recovers data from views means, nor do I know what a SAS-readable format is.crthompson
Recovers data from view : has a DataTable object in memory with all the data. One that could be easily used to write the data to a .csv file, for instance. SAS readable format: a data file that can be imported directly into SAS without any intermediate conversion step.Giuseppe
The question is intended for people who know SAS, of course. Otherwise, I would have not asked it. I need to produce a .SAS7BDAT file from a DataTable inside C# which contains data from a SQL Server database. That's it.Giuseppe
Do you have access to a SAS installation or server of any sort? SAS is a closed format, and while SAS provides an OLEDB driver for reading SAS files, it doesn't provide a free way to write them.Joe
The importance of the SAS installation is in the writing. You normally would need a SAS installation (either a local copy of base, or a server) to write a SAS7BDAT.Joe

1 Answers

1
votes

This isn't possible without SAS, or a custom library not freely available.

SAS provides OLEDB drivers for this purpose, but they require a SAS installation (of various sorts), as referred to in this table. You can read SAS7BDAT with the free local provider, but not write.

CozyROC sells a SAS compatible .NET library that allows you to write to SAS directly. That's the only way I'm aware you could do this. Alan Churchill has done this also on his own (decoded the SAS7BDAT format), but I suspect he sold his work to CozyROC since he now links to them.