<?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: How to write macro to extract first obs from particular library in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302518#M60715</link>
    <description>&lt;P&gt;Use the &lt;FONT face="courier new,courier"&gt;having&lt;/FONT&gt; clause and the &lt;FONT face="courier new,courier"&gt;max()&lt;/FONT&gt; summary function in SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from dictionary.tables
where libname = 'common'
having crdate = max(crdate);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 05 Oct 2016 05:54:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-10-05T05:54:38Z</dc:date>
    <item>
      <title>How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302245#M60692</link>
      <description>Hi how to write a macro to extract first obs from library which is shorted by crdate if first obs is blank then its need to extract second obs so on... Kindly help me</description>
      <pubDate>Tue, 04 Oct 2016 05:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302245#M60692</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-04T05:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302262#M60695</link>
      <description>&lt;P&gt;When you need to write a macro you first need working code and then you convert it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have working code that needs to be turned into a macro? And since this is a trivial task why do you need a macro? Which parts are dynamic in nature. Please be more explicit in your questions.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 05:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302262#M60695</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-04T05:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302267#M60696</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Yes I've working code, whenever I run the working code it'll generate new&lt;BR /&gt;dataset here I need only that dataset some times if data is not available&lt;BR /&gt;old dataset will be there. So I need write a macro so that it can extractt&lt;BR /&gt;first obs dataset.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Ravikumar&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Tue, 04 Oct 2016 06:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302267#M60696</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-04T06:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302272#M60697</link>
      <description>&lt;P&gt;Post the code and describe which part of it should be parameterized.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 07:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302272#M60697</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-04T07:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302280#M60698</link>
      <description>&lt;P&gt;Post code, and examples to clarify the question. &amp;nbsp;As for your problem, why do you need a macro?&lt;/P&gt;
&lt;PRE&gt;/* Test data */&lt;BR /&gt;proc sql;
  create table a (a char(2));
quit;
data b;
  b=1;
run;

/* This is the code */
proc sort data=sashelp.vtable out=inter;
  by memname;
  where libname="WORK" and nobs &amp;gt; 0;
run;
data _null_;
  set inter (obs=1);
  call execute(cats('data want; set work.',memname,' (obs=1); run;'));
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Oct 2016 08:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302280#M60698</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-04T08:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302284#M60700</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/104494"&gt;@Ravikumarpa4&lt;/a&gt; wrote:&lt;BR /&gt;Hi how to write a macro to extract first obs from library which is shorted by crdate if first obs is blank then its need to extract second obs so on... Kindly help me&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Libraries have datasets, and datasets have observations. Libraries do not have observations.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 08:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302284#M60700</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-04T08:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302516#M60714</link>
      <description>Hi&lt;BR /&gt;Code which I wrote is&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table abc as&lt;BR /&gt;Select * from&lt;BR /&gt;Dictionary.tables&lt;BR /&gt;Where libname= 'common'&lt;BR /&gt;Order by crdate desc;&lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;When I'm running above code its shows all the datasets in that library but&lt;BR /&gt;I want only one data set which is created most recently by writing macro.&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Wed, 05 Oct 2016 05:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302516#M60714</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-05T05:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302518#M60715</link>
      <description>&lt;P&gt;Use the &lt;FONT face="courier new,courier"&gt;having&lt;/FONT&gt; clause and the &lt;FONT face="courier new,courier"&gt;max()&lt;/FONT&gt; summary function in SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from dictionary.tables
where libname = 'common'
having crdate = max(crdate);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Oct 2016 05:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302518#M60715</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-05T05:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302527#M60716</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Now coding is working fine but I need assign macro how to do that,?&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Wed, 05 Oct 2016 07:50:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302527#M60716</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-05T07:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302534#M60718</link>
      <description>&lt;P&gt;Which parts of the code need to be parameterized?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 08:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302534#M60718</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-05T08:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302541#M60719</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;crdate part&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Wed, 05 Oct 2016 09:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302541#M60719</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-05T09:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302544#M60721</link>
      <description>&lt;P&gt;Do you want to change the variable that's used, or do you want to compare with a specific value?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 09:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302544#M60721</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-05T09:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302548#M60723</link>
      <description>Hi&lt;BR /&gt;variable will be same but value will change&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Wed, 05 Oct 2016 09:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302548#M60723</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-05T09:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302551#M60724</link>
      <description>&lt;P&gt;But the max crdate is always used. If the variable name doesn't change that doesn't need to be parametrized.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post a few different versions of what the code would be for us to understand what you need a macro for.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 09:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302551#M60724</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-05T09:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302564#M60726</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Now I need to assign macro to 'memname' variable then how can I do.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Wed, 05 Oct 2016 10:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302564#M60726</guid>
      <dc:creator>Ravikumarpa4</dc:creator>
      <dc:date>2016-10-05T10:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write macro to extract first obs from particular library</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302572#M60728</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro your_macro_name(memname);

*here comes your code;
*example;
where memname = "&amp;amp;memname";

*further code;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Oct 2016 10:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-write-macro-to-extract-first-obs-from-particular-library/m-p/302572#M60728</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-05T10:49:17Z</dc:date>
    </item>
  </channel>
</rss>

