Esempio n. 1
0
 /// <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.
 /// </summary>
 /// <param name="sd"></param>
 internal static void AssignLocalLibraryIfNeeded(ISASTaskConsumer3 consumer)
 {
     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);
             SasSubmitter submitter = new SasSubmitter(sd.Server);
             string       log;
             submitter.SubmitSasProgramAndWait(string.Format("libname {0} \"{1}\";\r\n", sd.Libref, path), out log);
         }
     }
 }
Esempio n. 2
0
 /// <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.  
 /// </summary>
 /// <param name="sd"></param>
 internal static void AssignLocalLibraryIfNeeded(ISASTaskConsumer3 consumer)
 {
     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);
             SasSubmitter submitter = new SasSubmitter(sd.Server);
             string log;
             submitter.SubmitSasProgramAndWait(string.Format("libname {0} \"{1}\";\r\n", sd.Libref, path), out log);
         }
     }
 }