/// <summary> /// In the special case where we have a local SAS data set file (sas7bdat), /// and a local SAS server, we have to make sure that there is a library /// assigned. The DatasetConverter class can read data only from a /// data source that is accessed via a SAS library (LIBNAME.MEMBER). /// </summary> /// <param name="sd"></param> internal static void AssignLocalLibraryIfNeeded(ISASTaskConsumer3 consumer, SasTask taskModel) { SAS.Tasks.Toolkit.Data.SasData sd = new SAS.Tasks.Toolkit.Data.SasData(consumer.ActiveData as ISASTaskData2); // get a SasServer object so we can see if it's the "Local" server SAS.Tasks.Toolkit.SasServer server = new SAS.Tasks.Toolkit.SasServer(sd.Server); // local server with local file, so we have to assign library if (server.IsLocal) { // see if the data reference is a file path ("c:\data\myfile.sas7bdat") if (!string.IsNullOrEmpty(consumer.ActiveData.File) && consumer.ActiveData.Source == SourceType.SasDataset && consumer.ActiveData.File.Contains("\\")) { string path = System.IO.Path.GetDirectoryName(consumer.ActiveData.File); taskModel.SubmitSASProgramAndWait(string.Format("libname {0} \"{1}\";\r\n", sd.Libref, path)); } } }