<?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: Query to find Freq in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70060#M20165</link>
    <description>I'm not sure if I can follow you logic, but I'm pretty sure you can solve this using data step programming with RETAIN and/or LAG().&lt;BR /&gt;
/Linus</description>
    <pubDate>Tue, 08 Sep 2009 13:25:04 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2009-09-08T13:25:04Z</dc:date>
    <item>
      <title>Query to find Freq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70059#M20164</link>
      <description>Jacob,&lt;BR /&gt;
                   &lt;BR /&gt;
                Query to set a Freq, description is as follows,i require the code to set Freq as shown in Freq coloumn&lt;BR /&gt;
 &lt;BR /&gt;
Time         Volatge        Flag      Freq&lt;BR /&gt;
1                230            0             1&lt;BR /&gt;
2                233            0             0&lt;BR /&gt;
3                231            0             0&lt;BR /&gt;
4                215            1             1&lt;BR /&gt;
5                211            1             0&lt;BR /&gt;
6                242            2             1&lt;BR /&gt;
7               248            2              0&lt;BR /&gt;
8                 246           2             0&lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
Flag parameter used is as per values of voltage for example if voltage is&amp;gt;240 its 2 and if voltage is &amp;lt; 216 then 1 else 0,but i require the code to find out "freq"which is such that if for time slot 1 voltage is 230 and its flag is 0 then freq is 0,but in next slot if value is in that range&amp;gt;216 and &amp;lt;240 then it shld be 0,and again if in next slot if the value of voltage is 242 then freq shld be 1,then again if it continues in that range then 0,and if next slot if value is less than 216 or in that range then it shld change to 1.&lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
Thanks,</description>
      <pubDate>Tue, 08 Sep 2009 13:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70059#M20164</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-08T13:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Query to find Freq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70060#M20165</link>
      <description>I'm not sure if I can follow you logic, but I'm pretty sure you can solve this using data step programming with RETAIN and/or LAG().&lt;BR /&gt;
/Linus</description>
      <pubDate>Tue, 08 Sep 2009 13:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70060#M20165</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-09-08T13:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Query to find Freq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70061#M20166</link>
      <description>Agreed with Linus, straighforward DATA step programming using a sorted input SAS file will work.  A starting point link is provided below -- also, you can use the SEARCH facility at the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website to locate SAS-hosted documentation and supplemental technical/conference topic-related reference.  Within the DATA step area, as Linus mentioned, related SAS statements are RETAIN and using the LAG function, or possibly FIRST.&lt;BREAKVARIABLE&gt; and/or LAST.&lt;BREAKVARIABLE&gt;  in your DATA step program.  You should also consider adding the SAS PUTLOG statement below periodically (during program development and testing) in order to dump SAS variable value conditions as you discover more about the DATA step programming world:&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG '&amp;gt;DIAG-nn' / _ALL_;   * set nn to unique values to see in your log ;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Introduction to DATA Step Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001302699.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001302699.htm&lt;/A&gt;&lt;/BREAKVARIABLE&gt;&lt;/BREAKVARIABLE&gt;</description>
      <pubDate>Tue, 08 Sep 2009 15:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-to-find-Freq/m-p/70061#M20166</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-08T15:32:54Z</dc:date>
    </item>
  </channel>
</rss>

