<?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: Assign values to Macro from SQL Database in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5999#M543</link>
    <description>The above solution did worked out, but whenever it find out any error, the set option is set to obs=0. Therefore, no records are read or processed &amp;amp; whatever datasets are created has 0 records...&lt;BR /&gt;
the error I get is as follows:&lt;BR /&gt;
&lt;I&gt;&lt;BR /&gt;
&lt;I&gt;MPRINT(READTBL):   *PRIYA: SORTING DATASETS;&lt;BR /&gt;
SYMBOLGEN:  Macro variable TBL resolves to LAB&lt;BR /&gt;
MPRINT(READTBL):   PROC SORT DATA = DATA0047.LAB;&lt;BR /&gt;
MPRINT(READTBL):   BY PATID VISIT SEQNUM ;&lt;BR /&gt;
ERROR: Variable SENUM not found.&lt;BR /&gt;
ERROR: Variable SENUM not found.&lt;BR /&gt;
ERROR: Variable SENUM not found.&lt;BR /&gt;
MPRINT(READTBL):   RUN;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: SAS set option OBS=0 and will continue to check statements. &lt;BR /&gt;
      This may cause NOTE: No observations in data set.&lt;BR /&gt;
NOTE: PROCEDURE SORT used:&lt;BR /&gt;
      real time           0.03 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;/I&gt;&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
Can someone help me to reslove this issue.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Priya</description>
    <pubDate>Thu, 27 Dec 2007 21:01:55 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-12-27T21:01:55Z</dc:date>
    <item>
      <title>Assign values to Macro from SQL Database</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5996#M540</link>
      <description>The problem goes like this: &lt;BR /&gt;
I want to read the values of a variable in a table in SQL Database and each of this value should be given as an input to a SAS Macro which generate  sas dataset according to the values given to the Macros, e.g., like if AE is the first value of the table, it should b read from database and give as the input to the Macro.   This should b run for every value of the column in the database table. &lt;BR /&gt;
I use the following code:&lt;BR /&gt;
&lt;BR /&gt;
%let tbl=;&lt;BR /&gt;
%macro DATASET;&lt;BR /&gt;
%let n=1;&lt;BR /&gt;
%do n %to &amp;amp;ds;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
	select datasetname format=$10. into :tbl&lt;BR /&gt;
	from datalib.ds_attributes&lt;BR /&gt;
	order by datasetname;&lt;BR /&gt;
 	%readtbl(tbl=&amp;amp;tbl);&lt;BR /&gt;
      quit;&lt;BR /&gt;
 %end;&lt;BR /&gt;
  %put &amp;amp;tbl;&lt;BR /&gt;
%mend DATASET;&lt;BR /&gt;
%dataset;&lt;BR /&gt;
&lt;BR /&gt;
I am sure v can do this by assign any do loop function, but It reads only the first value of the variable and runs as many times as &amp;amp;DS, ultimately brings out an error.&lt;BR /&gt;
Let me know if any solutions.</description>
      <pubDate>Wed, 19 Dec 2007 16:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5996#M540</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-19T16:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Assign values to Macro from SQL Database</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5997#M541</link>
      <description>see a solution for invoking a macro multiple times from a data set, in a parallel forum at&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?threadID=2294&amp;amp;tstart=0" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=2294&amp;amp;tstart=0&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
The only difference is that your data set uses a library engine pointing into an SQL database &lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 19 Dec 2007 17:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5997#M541</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-19T17:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Assign values to Macro from SQL Database</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5998#M542</link>
      <description>Thanks that worked. It was really helpful.</description>
      <pubDate>Wed, 19 Dec 2007 22:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5998#M542</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-19T22:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Assign values to Macro from SQL Database</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5999#M543</link>
      <description>The above solution did worked out, but whenever it find out any error, the set option is set to obs=0. Therefore, no records are read or processed &amp;amp; whatever datasets are created has 0 records...&lt;BR /&gt;
the error I get is as follows:&lt;BR /&gt;
&lt;I&gt;&lt;BR /&gt;
&lt;I&gt;MPRINT(READTBL):   *PRIYA: SORTING DATASETS;&lt;BR /&gt;
SYMBOLGEN:  Macro variable TBL resolves to LAB&lt;BR /&gt;
MPRINT(READTBL):   PROC SORT DATA = DATA0047.LAB;&lt;BR /&gt;
MPRINT(READTBL):   BY PATID VISIT SEQNUM ;&lt;BR /&gt;
ERROR: Variable SENUM not found.&lt;BR /&gt;
ERROR: Variable SENUM not found.&lt;BR /&gt;
ERROR: Variable SENUM not found.&lt;BR /&gt;
MPRINT(READTBL):   RUN;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: SAS set option OBS=0 and will continue to check statements. &lt;BR /&gt;
      This may cause NOTE: No observations in data set.&lt;BR /&gt;
NOTE: PROCEDURE SORT used:&lt;BR /&gt;
      real time           0.03 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;/I&gt;&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
Can someone help me to reslove this issue.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Priya</description>
      <pubDate>Thu, 27 Dec 2007 21:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Assign-values-to-Macro-from-SQL-Database/m-p/5999#M543</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-27T21:01:55Z</dc:date>
    </item>
  </channel>
</rss>

