<?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 Re: Help explain what the code doing in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118750#M32761</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This executes a stored procedure on what looks like a SQL Server database using SAS/Access for ODBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The connect statement establishes a connection to the database: the details of this are in the dsn (Data Source Name) specified - this would specify the server, port and database names (use your ODBC manager software to see these) and the user and pw options specify the authentication credentials. The "as xyzp" part establishes an alias: without it you would have to replace any references to "xyzp" with "odbc". You could conceivably have several ODBC connections on the go and so you would need to be able to differentiate between them when passing code to them. But if you only have the one connection the alias isn't strictly necessary. The execute statement passes the contents of the parentheses directly to the database to run itself. Any output would be passed back to SAS.&lt;/P&gt;&lt;P&gt;One thing that the code is missing is a disconnect statement: this should go between the execute and quit statements and consist of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;disconnect from xyzp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm afraid I'm not very up on SQL Server so I can't really help with the details of the stored procedure that is run in this case. I think the [dbo] bit specifies the schema and the [sp_report_indexCreate] specifies the procedure name but I don't know what the [xyz] bit is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Nigel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 May 2012 14:35:45 GMT</pubDate>
    <dc:creator>Nigel_Pain</dc:creator>
    <dc:date>2012-05-17T14:35:45Z</dc:date>
    <item>
      <title>Help explain what the code doing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118749#M32760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;Does anybody could explain the meaning of code to me?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to odbc as xyzp (dsn=asdf user=wind pw=cool);&lt;/P&gt;&lt;P&gt;execute (exec [xyz].[dbo].[sp_report_indexCreate]) by xyzp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2012 13:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118749#M32760</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-05-17T13:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help explain what the code doing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118750#M32761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This executes a stored procedure on what looks like a SQL Server database using SAS/Access for ODBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The connect statement establishes a connection to the database: the details of this are in the dsn (Data Source Name) specified - this would specify the server, port and database names (use your ODBC manager software to see these) and the user and pw options specify the authentication credentials. The "as xyzp" part establishes an alias: without it you would have to replace any references to "xyzp" with "odbc". You could conceivably have several ODBC connections on the go and so you would need to be able to differentiate between them when passing code to them. But if you only have the one connection the alias isn't strictly necessary. The execute statement passes the contents of the parentheses directly to the database to run itself. Any output would be passed back to SAS.&lt;/P&gt;&lt;P&gt;One thing that the code is missing is a disconnect statement: this should go between the execute and quit statements and consist of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;disconnect from xyzp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm afraid I'm not very up on SQL Server so I can't really help with the details of the stored procedure that is run in this case. I think the [dbo] bit specifies the schema and the [sp_report_indexCreate] specifies the procedure name but I don't know what the [xyz] bit is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Nigel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2012 14:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118750#M32761</guid>
      <dc:creator>Nigel_Pain</dc:creator>
      <dc:date>2012-05-17T14:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help explain what the code doing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118751#M32762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for sql server,using T-SQL&lt;/P&gt;&lt;P&gt;here is an example of&amp;nbsp; create a stored procedure one with a parameter x :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE PROCEDURE one @x char(10)&lt;BR /&gt;AS&lt;BR /&gt;SELECT * &lt;BR /&gt;FROM sashelp.class&lt;/P&gt;&lt;P&gt;WHERE x= @x&lt;BR /&gt; go&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;To call this stored procedure one :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;EXEC one @x = 'M'' &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2012 16:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-explain-what-the-code-doing/m-p/118751#M32762</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-05-17T16:11:44Z</dc:date>
    </item>
  </channel>
</rss>

