<?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: Macro Function ...  Need Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22757#M3697</link>
    <description>See if this one on sas-l helps:&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1010A&amp;amp;L=sas-l&amp;amp;P=R22861&amp;amp;D=1&amp;amp;H=0&amp;amp;O=D&amp;amp;T=1" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1010A&amp;amp;L=sas-l&amp;amp;P=R22861&amp;amp;D=1&amp;amp;H=0&amp;amp;O=D&amp;amp;T=1&lt;/A&gt;</description>
    <pubDate>Tue, 26 Oct 2010 14:11:54 GMT</pubDate>
    <dc:creator>chang_y_chung_hotmail_com</dc:creator>
    <dc:date>2010-10-26T14:11:54Z</dc:date>
    <item>
      <title>Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22756#M3696</link>
      <description>%macro TestGet(MACROV,Data=lib.test);&lt;BR /&gt;
%local dsid;&lt;BR /&gt;
%let dsid=%sysfunc(OPEN(&amp;amp;Data(where=(NAME="&amp;amp;NAME"))));&lt;BR /&gt;
%let dsid=%sysfunc(CLOSE(&amp;amp;dsid));&lt;BR /&gt;
%mend TestGet;&lt;BR /&gt;
________________________________________________&lt;BR /&gt;
&lt;BR /&gt;
%macro hey;&lt;BR /&gt;
%let service=%TestGet(can,data=lib.test);&lt;BR /&gt;
%put &amp;amp;service;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
________________________________________________&lt;BR /&gt;
&lt;BR /&gt;
My Dataset is:&lt;BR /&gt;
&lt;BR /&gt;
id            name&lt;BR /&gt;
1             ali&lt;BR /&gt;
2             veli&lt;BR /&gt;
3             can&lt;BR /&gt;
4             cin&lt;BR /&gt;
&lt;BR /&gt;
I've written two pieces of macro procedures. First macro is to generalize of retrieving a data from a dataset. First parameter is the data to be looked up in the dataset,and the second is the dataset name. I've created a local macro variable to initialize the look-up data to that variable. &lt;BR /&gt;
So in the second procedure, i am trying to get the look-up data in the dataset and try tp print it to the log.&lt;BR /&gt;
&lt;BR /&gt;
But i am proably doing something wrong. Could you please help me.&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
Can Akcan</description>
      <pubDate>Tue, 26 Oct 2010 11:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22756#M3696</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-26T11:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22757#M3697</link>
      <description>See if this one on sas-l helps:&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1010A&amp;amp;L=sas-l&amp;amp;P=R22861&amp;amp;D=1&amp;amp;H=0&amp;amp;O=D&amp;amp;T=1" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1010A&amp;amp;L=sas-l&amp;amp;P=R22861&amp;amp;D=1&amp;amp;H=0&amp;amp;O=D&amp;amp;T=1&lt;/A&gt;</description>
      <pubDate>Tue, 26 Oct 2010 14:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22757#M3697</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2010-10-26T14:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22758#M3698</link>
      <description>Hello Cakcan,&lt;BR /&gt;
&lt;BR /&gt;
I am not sure what you are going to acheve. If you would like to test a succes of opening and closing a dataset then the following change to your code could help:&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
  input id name $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 ali&lt;BR /&gt;
2 veli&lt;BR /&gt;
3 can&lt;BR /&gt;
4 cin&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
options symbolgen mprint;&lt;BR /&gt;
&lt;BR /&gt;
%macro TestGet(name,Data=lib.test);&lt;BR /&gt;
%global dsid dsid1;&lt;BR /&gt;
%let dsid=%sysfunc(OPEN(&amp;amp;Data(where=(NAME="&amp;amp;NAME"))));&lt;BR /&gt;
%let dsid1=%sysfunc(CLOSE(&amp;amp;dsid));&lt;BR /&gt;
%mend TestGet;&lt;BR /&gt;
&lt;BR /&gt;
%macro hey;&lt;BR /&gt;
%TestGet(name,data=work.a);&lt;BR /&gt;
%put dsid=&amp;amp;dsid dsid1=&amp;amp;dsid1;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
%hey&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Tue, 26 Oct 2010 14:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22758#M3698</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-10-26T14:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22759#M3699</link>
      <description>my aim is to open a dataset, assign variable to a macro variable in the dataset and close it and then finally i have a generalized function which i write the name of the dataset and the column name and retieve the data from the that dataset. thats it. I hope it is clear.</description>
      <pubDate>Tue, 26 Oct 2010 14:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22759#M3699</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-26T14:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22760#M3700</link>
      <description>This my second attempt to understand what you need. The code below creates a dataset _a that contains the observation from input dataset for name="can". Is this what you need? or you need only ID for "can"?&lt;BR /&gt;
&lt;BR /&gt;
%macro TestGet(name,Data=lib.test);&lt;BR /&gt;
%local dsid;&lt;BR /&gt;
%let dsid=%sysfunc(OPEN(&amp;amp;Data(where=(NAME="&amp;amp;NAME"))));&lt;BR /&gt;
%if &amp;amp;dsid NE 0 %then %do;&lt;BR /&gt;
data _a;&lt;BR /&gt;
  set &amp;amp;Data(where=(NAME="&amp;amp;NAME"));&lt;BR /&gt;
  run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%else %put Error in &amp;amp;data;&lt;BR /&gt;
%let dsid=%sysfunc(CLOSE(&amp;amp;dsid));&lt;BR /&gt;
%mend TestGet;&lt;BR /&gt;
&lt;BR /&gt;
%macro hey;&lt;BR /&gt;
%TestGet(can,data=work.a);&lt;BR /&gt;
proc print data=_a;&lt;BR /&gt;
run;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
%hey</description>
      <pubDate>Tue, 26 Oct 2010 15:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22760#M3700</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-10-26T15:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22761#M3701</link>
      <description>Cakcan,&lt;BR /&gt;
Notice then name change of the positional parameter in SPR's code.  But I am worried about your statement of the problem.  We are a bit confused because macro variables are not, in any way, assigned to data sets.  You do not need to open a data set to create a macro variable.  Macro variables are held in memory for the duration of the SAS job or session.  The values of macro variables can be used in the process of data set variable creation and assignment, but that is a very different process than the one you have started here.&lt;BR /&gt;
Art</description>
      <pubDate>Wed, 27 Oct 2010 04:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22761#M3701</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-10-27T04:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Function ...  Need Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22762#M3702</link>
      <description>Thank you for your comments. I've got to the point where i want to achieve. &lt;BR /&gt;
Thanx a lot.&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
Cakcan</description>
      <pubDate>Wed, 27 Oct 2010 07:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Function-Need-Help/m-p/22762#M3702</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-27T07:10:06Z</dc:date>
    </item>
  </channel>
</rss>

