<?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: locating the time with a specific condition in time series in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/locating-the-time-with-a-specific-condition-in-time-series/m-p/279829#M59013</link>
    <description>&lt;P&gt;For the getting time something like this will work. The idea is we take advantage of the implicit loop in the SAS datastep and once it hits our threshold (here set to 35), it outputs that time value into a macro variable called tval and then stops the datastep.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
	input time var;

datalines;
1     10
2     12
3     15
4     35
5     48
6     60
7     87
8     120
;
run;

proc sort data=ds1; by time; run;

data _NULL_;
	set ds1;

	if var &amp;gt;= 35 then do;
		call symput("tval",strip(put(time,3.)));
		stop;
	end;
run;

%put &amp;amp;tval;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jun 2016 19:45:20 GMT</pubDate>
    <dc:creator>slacey</dc:creator>
    <dc:date>2016-06-23T19:45:20Z</dc:date>
    <item>
      <title>locating the time with a specific condition in time series</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/locating-the-time-with-a-specific-condition-in-time-series/m-p/279810#M59012</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I am running computer simulations and recording the values of a variable over time. I need to find out the when the variable reaches a predefined value for the first time and store it for further analysis. Can this be done in SAS? Also is there a procedure to calculate autocorrelation of a time series for a specific period of time (e.g. t=60 to t=200)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data will look like something like this:&lt;/P&gt;&lt;P&gt;time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;variable&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 15&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35&lt;/P&gt;&lt;P&gt;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 48&lt;/P&gt;&lt;P&gt;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;60&lt;/P&gt;&lt;P&gt;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;87&lt;/P&gt;&lt;P&gt;8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;120&lt;/P&gt;&lt;P&gt;and I need to find out at what time variable becomes greater than or equal to 35. The output of the code should be t=4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 19:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/locating-the-time-with-a-specific-condition-in-time-series/m-p/279810#M59012</guid>
      <dc:creator>yjalilik</dc:creator>
      <dc:date>2016-06-23T19:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: locating the time with a specific condition in time series</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/locating-the-time-with-a-specific-condition-in-time-series/m-p/279829#M59013</link>
      <description>&lt;P&gt;For the getting time something like this will work. The idea is we take advantage of the implicit loop in the SAS datastep and once it hits our threshold (here set to 35), it outputs that time value into a macro variable called tval and then stops the datastep.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds1;
	input time var;

datalines;
1     10
2     12
3     15
4     35
5     48
6     60
7     87
8     120
;
run;

proc sort data=ds1; by time; run;

data _NULL_;
	set ds1;

	if var &amp;gt;= 35 then do;
		call symput("tval",strip(put(time,3.)));
		stop;
	end;
run;

%put &amp;amp;tval;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2016 19:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/locating-the-time-with-a-specific-condition-in-time-series/m-p/279829#M59013</guid>
      <dc:creator>slacey</dc:creator>
      <dc:date>2016-06-23T19:45:20Z</dc:date>
    </item>
  </channel>
</rss>

