<?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: Obtain the latest collection date in Proc Freq or from extra Data steps? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936275#M368043</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a &lt;CODE&gt;PROC FREQ&lt;/CODE&gt; code listed below in the frequency output dataset, CNT. I would like to obtain information for the latest collection date in the "Have" dataset. Is there a way to add a step in the &lt;CODE&gt;PROC FREQ&lt;/CODE&gt; procedure, or do I need to add an extra data step and merge it with the output CNT data? Please help, thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You ask "for the latest collection date in the "Have" dataset" but your code is getting counts by LabIds and Test_code. So should that request be "for the latest collection date in the "Have" for each LabIds and Test_code combination in the dataset"? Quite a bit different things.&lt;/P&gt;
&lt;P&gt;If you want latest date for each combination of LabIds and Test_code AND have a collection date variable one way AND that the sort order for the collection date variable sorts in date order (i.e and an actual SAS date value or a YYYYMMDD value) the following should work.&lt;/P&gt;
&lt;PRE&gt;Proc freq data=Have noprint; 
	table  LabIDs*Test_Code*collectiondate*Match / nopercent nocol  out=CNT;
	where match in ('N');
run;

data want;
   set count;
   by Labids test_code;
   if last.test_code;l
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jul 2024 19:53:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-07-18T19:53:50Z</dc:date>
    <item>
      <title>Obtain the latest collection date in Proc Freq or from extra Data steps?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936271#M368041</link>
      <description>&lt;P&gt;I have a &lt;CODE&gt;PROC FREQ&lt;/CODE&gt; code listed below in the frequency output dataset, CNT. I would like to obtain information for the latest collection date in the "Have" dataset. Is there a way to add a step in the &lt;CODE&gt;PROC FREQ&lt;/CODE&gt; procedure, or do I need to add an extra data step and merge it with the output CNT data? Please help, thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc freq data=Have noprint; 
	table  LabIDs*Test_Code*Match / nopercent nocol  out=CNT;
	where match in ('N');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jul 2024 19:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936271#M368041</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2024-07-18T19:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain the latest collection date in Proc Freq or from extra Data steps?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936272#M368042</link>
      <description>&lt;P&gt;You do not provide enough information to answer your own question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mainly, what exactly do you mean by "collection date"?&amp;nbsp; Is it a variable in the dataset HAVE?&amp;nbsp; You specify three variables in HAVE (Labids, test_code, match), none of which suggest a collection date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it the creation date of HAVE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, there is no need for the &lt;EM&gt;&lt;STRONG&gt;** match"&lt;/STRONG&gt;&lt;/EM&gt; expression in the TABLE statement, since you allow only one match value,&amp;nbsp; i.e. &lt;EM&gt;&lt;STRONG&gt;where match in ('N')&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please clarify.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 19:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936272#M368042</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-07-18T19:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain the latest collection date in Proc Freq or from extra Data steps?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936275#M368043</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a &lt;CODE&gt;PROC FREQ&lt;/CODE&gt; code listed below in the frequency output dataset, CNT. I would like to obtain information for the latest collection date in the "Have" dataset. Is there a way to add a step in the &lt;CODE&gt;PROC FREQ&lt;/CODE&gt; procedure, or do I need to add an extra data step and merge it with the output CNT data? Please help, thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You ask "for the latest collection date in the "Have" dataset" but your code is getting counts by LabIds and Test_code. So should that request be "for the latest collection date in the "Have" for each LabIds and Test_code combination in the dataset"? Quite a bit different things.&lt;/P&gt;
&lt;P&gt;If you want latest date for each combination of LabIds and Test_code AND have a collection date variable one way AND that the sort order for the collection date variable sorts in date order (i.e and an actual SAS date value or a YYYYMMDD value) the following should work.&lt;/P&gt;
&lt;PRE&gt;Proc freq data=Have noprint; 
	table  LabIDs*Test_Code*collectiondate*Match / nopercent nocol  out=CNT;
	where match in ('N');
run;

data want;
   set count;
   by Labids test_code;
   if last.test_code;l
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 19:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936275#M368043</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-07-18T19:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain the latest collection date in Proc Freq or from extra Data steps?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936276#M368044</link>
      <description>&lt;P&gt;The Collection_Date volume (mmddyy10.) is in the "Have" dataset, but not in the CNT frequency output dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 19:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtain-the-latest-collection-date-in-Proc-Freq-or-from-extra/m-p/936276#M368044</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2024-07-18T19:58:33Z</dc:date>
    </item>
  </channel>
</rss>

