<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAS EG Addin question in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/641#M154</link>
    <description>Hi guys, Chris,&lt;BR /&gt;
I am new to both SAS and Visual Studio. For the last couple of weeks I have learned to write a SAS macro for my financial auditing job. My boss wants me to develop a custom task for SAS EG using VB. We now have Visual Studio 2005 pro. I spend a few days searching the web and trying to understand the codes of some sample custom tasks on the web but only got a very rough picture. Some points still confused me, for example&lt;BR /&gt;
&lt;BR /&gt;
How to call a SAS macro with parameters in VB ?(although I have seen an equivalent C# code from one of the sample custom tasks downloaded from SAS support page)&lt;BR /&gt;
&lt;BR /&gt;
How to create the .dll file?  etc. &lt;BR /&gt;
&lt;BR /&gt;
Any suggestions, pointer or examples on this? Much appreciated.</description>
    <pubDate>Thu, 11 May 2006 21:55:37 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2006-05-11T21:55:37Z</dc:date>
    <item>
      <title>SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/641#M154</link>
      <description>Hi guys, Chris,&lt;BR /&gt;
I am new to both SAS and Visual Studio. For the last couple of weeks I have learned to write a SAS macro for my financial auditing job. My boss wants me to develop a custom task for SAS EG using VB. We now have Visual Studio 2005 pro. I spend a few days searching the web and trying to understand the codes of some sample custom tasks on the web but only got a very rough picture. Some points still confused me, for example&lt;BR /&gt;
&lt;BR /&gt;
How to call a SAS macro with parameters in VB ?(although I have seen an equivalent C# code from one of the sample custom tasks downloaded from SAS support page)&lt;BR /&gt;
&lt;BR /&gt;
How to create the .dll file?  etc. &lt;BR /&gt;
&lt;BR /&gt;
Any suggestions, pointer or examples on this? Much appreciated.</description>
      <pubDate>Thu, 11 May 2006 21:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/641#M154</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-05-11T21:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/642#M155</link>
      <description>John,&lt;BR /&gt;
&lt;BR /&gt;
Most custom tasks simply generate SAS code based on user selections in one or more forms presented in the task.  When you already have a SAS macro that does the work you want, the only variation in the generated code from run to run is the parameters passed to the macro, or else perhaps some %LET statements to set up some variables.&lt;BR /&gt;
&lt;BR /&gt;
You're not calling the macro directly from the task; you are simply generating a SAS program that will call the macro when run within EG.&lt;BR /&gt;
&lt;BR /&gt;
Is there a C# example that we have that looks like what you want to do?  If so, post back and I'll try to provide some code snippets for a VB.NET equivalent.&lt;BR /&gt;
&lt;BR /&gt;
One other note: if you are using VS2005, you'll want to look at this thread:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?forumID=10&amp;amp;threadID=121&amp;amp;tstart=0" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?forumID=10&amp;amp;threadID=121&amp;amp;tstart=0&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
      <pubDate>Fri, 12 May 2006 13:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/642#M155</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2006-05-12T13:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/643#M156</link>
      <description>Thanks Chris, &lt;BR /&gt;
&lt;BR /&gt;
It helps me clarify things a little bit. And here is the C# code of a sample custom task from &lt;A href="http://support.sas.com/documentation/onlinedoc/guide/release30/addins/" target="_blank"&gt;http://support.sas.com/documentation/onlinedoc/guide/release30/addins/&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
	public string SasCode&lt;BR /&gt;
		{&lt;BR /&gt;
			get&lt;BR /&gt;
			{&lt;BR /&gt;
				string member = (bAllMembers || dataset.Length==0) ? "_ALL_" : dataset;&lt;BR /&gt;
				string co = catobs.ToString();&lt;BR /&gt;
				string macro = Global.ReadFileFromAssembly("EGAddin.CharacterizeData.Characterize_Data.sas");&lt;BR /&gt;
				string call = string.Format("%charact(dsn={0},lib={1},catobs={2});",member,library, co);&lt;BR /&gt;
				string charts = (bCharts) ? Global.ReadFileFromAssembly("EGAddin.CharacterizeData.GraphCode.sas") : "";&lt;BR /&gt;
&lt;BR /&gt;
				string code = macro + Environment.NewLine + call + Environment.NewLine + charts;&lt;BR /&gt;
&lt;BR /&gt;
				return code;&lt;BR /&gt;
			}&lt;BR /&gt;
		}&lt;BR /&gt;
&lt;BR /&gt;
I guess most of my questions are really from VB side. Any resources of VB programming for a beginner you would share?  Thanks a lot!</description>
      <pubDate>Fri, 12 May 2006 17:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/643#M156</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-05-12T17:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/644#M157</link>
      <description>Here is the VB.NET version of this function:&lt;BR /&gt;
&lt;BR /&gt;
Public Function get_SasCode() As String&lt;BR /&gt;
      Dim member As String = IIf((Me.bAllMembers OrElse (Me.dataset.Length = 0)), "_ALL_", Me.dataset)&lt;BR /&gt;
      Dim co As String = Me.catobs.ToString&lt;BR /&gt;
      Dim macro As String = Global.ReadFileFromAssembly("EGAddin.CharacterizeData.Characterize_Data.sas")&lt;BR /&gt;
      Dim call As String = String.Format("%charact(dsn={0},lib={1},catobs={2});", member, Me.library, co)&lt;BR /&gt;
      Dim charts As String = IIf(Me.bCharts, Global.ReadFileFromAssembly("EGAddin.CharacterizeData.GraphCode.sas"), "")&lt;BR /&gt;
      Return macro &amp;amp; Environment.NewLine &amp;amp; call &amp;amp; Environment.NewLine &amp;amp; charts&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
 &lt;BR /&gt;
Great places to start with .NET development:&lt;BR /&gt;
&lt;A href="http://www.gotdotnet.com" target="_blank"&gt;http://www.gotdotnet.com&lt;/A&gt; (Microsoft-supported community)&lt;BR /&gt;
&lt;A href="http://www.codeproject.com" target="_blank"&gt;http://www.codeproject.com&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
      <pubDate>Mon, 15 May 2006 14:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/644#M157</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2006-05-15T14:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/645#M158</link>
      <description>Thanks a million Chris!</description>
      <pubDate>Mon, 15 May 2006 16:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/645#M158</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-05-15T16:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/646#M159</link>
      <description>Hi Chris,&lt;BR /&gt;
I have another question, under ISASTaskDescription, where does the Clsid come from, here's the example from the SAS custom task page,&lt;BR /&gt;
&lt;BR /&gt;
Public ReadOnly Property Clsid() As String Implements SAS.EG.AddIns.ISASTaskDescription.Clsid&lt;BR /&gt;
  Get&lt;BR /&gt;
     Clsid = "7c02a543-9187-40ef-a835-b59420ce6fb9"&lt;BR /&gt;
  End Get&lt;BR /&gt;
End Property&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
John</description>
      <pubDate>Mon, 29 May 2006 16:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/646#M159</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-05-29T16:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/647#M160</link>
      <description>John,&lt;BR /&gt;
&lt;BR /&gt;
The Clsid property returns a value called a GUID, which you can generate easily from a Visual Studio command prompt.  Simply run "uuidgen", and it will generate one for you -- copy and paste it into your task code.&lt;BR /&gt;
&lt;BR /&gt;
The Visual Studio templates that we provide (for VS2003) will generate the value for you.  If you are developing a task without using the templates, you'll have to use uuidgen.&lt;BR /&gt;
&lt;BR /&gt;
It's important to supply a unique value for the Clsid for each task.  This value is how Enterprise Guide can distinguish one task from another.  If you have two or more tasks with the same Clsid value in your \Custom directory, Enterprise Guide will show only the first one it finds.&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
      <pubDate>Tue, 30 May 2006 13:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/647#M160</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2006-05-30T13:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/648#M161</link>
      <description>Thanks again Chris! &lt;BR /&gt;
&lt;BR /&gt;
Where do I copy the number generated by uuidgen.exe into? Clsid property or Assembly &amp;gt; UGID? &lt;BR /&gt;
&lt;BR /&gt;
And why do I keep getting such addin manager error message "the add-in does not contain the correct interface signature"? Is that because I am using Visual Studio 2005?&lt;BR /&gt;
&lt;BR /&gt;
Since I can't use the VS 2003 template, can you please confirm this: &lt;BR /&gt;
&lt;BR /&gt;
All I need is an user interface Window form.vb and a classlibrary.vb implementing SASTask subs. All the other .vb like Assembly.vb will be generated by VS? &lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
John

&lt;BR /&gt;
Message was edited by: John_learntoSAS at Jun 1, 2006 1:35 PM&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jun 2006 04:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/648#M161</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-06-01T04:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/649#M162</link>
      <description>John,&lt;BR /&gt;
&lt;BR /&gt;
Yes, copy the GUID to the Clsid property implementation.&lt;BR /&gt;
&lt;BR /&gt;
And yes, since you don't have the benefit of the templates, you need to implement ISASTask, ISASTaskAddIn, and ISASTaskDescription yourself.  All of that is very easy with Visual Studio.&lt;BR /&gt;
&lt;BR /&gt;
See my previous posting re: using VS2005.  You cannot create custom tasks that use .NET 2.0 (EG 4.1 won't support that), so you'll need to target .NET 1.1 with VS2005.  That's possible to do with an extension called MSBee available from Microsoft.&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
      <pubDate>Fri, 02 Jun 2006 17:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/649#M162</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2006-06-02T17:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/650#M163</link>
      <description>Thanks Chris, you are such a great help!</description>
      <pubDate>Fri, 02 Jun 2006 17:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/650#M163</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-06-02T17:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/651#M164</link>
      <description>Thanks again Chris, I finished my little custom task and my boss was happy. One question though is how do I code the SAVE function (so I can save the process and schedule it just like the other tasks do)?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
cheers,&lt;BR /&gt;
John</description>
      <pubDate>Thu, 06 Jul 2006 21:35:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/651#M164</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-07-06T21:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/652#M165</link>
      <description>Hi Chris,&lt;BR /&gt;
&lt;BR /&gt;
The same question again. How do I code the SAVE function (so that the process is saved as a schedule task)? Much appreciated!&lt;BR /&gt;
&lt;BR /&gt;
cheers,&lt;BR /&gt;
John</description>
      <pubDate>Tue, 11 Jul 2006 16:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/652#M165</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2006-07-11T16:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG Addin question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/653#M166</link>
      <description>John,&lt;BR /&gt;
&lt;BR /&gt;
You'll need to code a replacement Public Property for XmlState (in ISASTask), which reads and writes the state of the task in XML format.  An example can be found in the following code (from ClassicHat.vb): &lt;BR /&gt;
&lt;BR /&gt;
Public Property XmlState() As String Implements _&lt;BR /&gt;
           SAS.Shared.AddIns.ISASTask.XmlState&lt;BR /&gt;
 Get&lt;BR /&gt;
  Dim sw As StringWriter = New StringWriter&lt;BR /&gt;
  Dim writer As XmlTextWriter = New XmlTextWriter(sw)&lt;BR /&gt;
  writer.WriteStartElement("ClassicHat")&lt;BR /&gt;
  writer.WriteElementString("Size", _&lt;BR /&gt;
                    XmlConvert.ToString(HatSize))&lt;BR /&gt;
  writer.WriteEndElement()&lt;BR /&gt;
  writer.Close()&lt;BR /&gt;
  XmlState = sw.ToString()&lt;BR /&gt;
 End Get&lt;BR /&gt;
 Set(ByVal Value As String)&lt;BR /&gt;
  If Value &amp;lt;&amp;gt; Nothing And Value.Length &amp;gt; 0 Then&lt;BR /&gt;
   Try&lt;BR /&gt;
    Dim sr As StringReader = New StringReader(Value)&lt;BR /&gt;
    Dim reader As XmlTextReader = New XmlTextReader(sr)&lt;BR /&gt;
    reader.ReadStartElement("ClassicHat")&lt;BR /&gt;
    HatSize = _&lt;BR /&gt;
     XmlConvert.ToInt32(reader.ReadElementString("Size"))&lt;BR /&gt;
    reader.ReadEndElement()&lt;BR /&gt;
    reader.Close()&lt;BR /&gt;
   Catch&lt;BR /&gt;
   End Try&lt;BR /&gt;
  End If&lt;BR /&gt;
 End Set&lt;BR /&gt;
End Property&lt;BR /&gt;
&lt;BR /&gt;
.............Phil</description>
      <pubDate>Tue, 11 Jul 2006 21:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-EG-Addin-question/m-p/653#M166</guid>
      <dc:creator>prholland</dc:creator>
      <dc:date>2006-07-11T21:11:50Z</dc:date>
    </item>
  </channel>
</rss>

