<?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: do loop and macro. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599579#M173097</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;if date is the 366th date, volume=(pseudovolume-psedovolume_lag)+volume at day 1.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think you have explained the desired analysis in any level of completeness so that we can provide an answer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So help me understand this ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 1: what is psedovolume_lag?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 2: What happens on day 731? Is it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;if date is the 731th date, volume=(pseudovolume-psedovolume_lag)+volume at day 1&lt;BR /&gt;or is it&lt;/LI&gt;
&lt;LI&gt;if date is the 731th date, volume=(pseudovolume-psedovolume_lag)+volume at day 366&lt;BR /&gt;or is it&lt;/LI&gt;
&lt;LI&gt;something else?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 3: What do you do about leap years?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 4: what is the desired output for days 1 to 365?&lt;/P&gt;</description>
    <pubDate>Sat, 26 Oct 2019 22:53:58 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-10-26T22:53:58Z</dc:date>
    <item>
      <title>do loop and macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599571#M173091</link>
      <description>&lt;P&gt;Hi, i have a data set that has millions of obs.&lt;/P&gt;&lt;P&gt;the variables are:&lt;/P&gt;&lt;P&gt;date, volume, companyname, pseudovolume&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the issue is that i only have volume until day 365 and have to roll the volume to get the next one starting the 366th date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, i would first sort the dataset by companyname and date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then i wanted to write a sas macro doing the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if date is the 366th date, volume=(pseudovolume-psedovolume_lag)+volume at day 1.&lt;/P&gt;&lt;P&gt;if date is the 367th date, volume=(pseudovolume-psedovolume_lag)+volume at day 2.&lt;/P&gt;&lt;P&gt;if date is the 368th date, volume=(pseudovolume-psedovolume_lag)+volume at day 3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have to do this on and on until 13000th date.&lt;/P&gt;&lt;P&gt;is there anyway to do this using sas macro ? thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2019 21:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599571#M173091</guid>
      <dc:creator>aaronsterri</dc:creator>
      <dc:date>2019-10-26T21:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: do loop and macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599576#M173094</link>
      <description>It's difficult to see what this question has to do with either macro language or do loops.  Perhaps you should begin by answering a few questions.&lt;BR /&gt;&lt;BR /&gt;Could there be multiple observations for the same company/date combination?&lt;BR /&gt;&lt;BR /&gt;How do you know whether it is day 1, day 2, etc.?&lt;BR /&gt;&lt;BR /&gt;If there are 4 days between one date and the next, how do you calculate the day?</description>
      <pubDate>Sat, 26 Oct 2019 22:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599576#M173094</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-26T22:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: do loop and macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599577#M173095</link>
      <description>&lt;P&gt;thank you so much for your note.&lt;/P&gt;&lt;P&gt;sorry i forgot to let you know that for each company, i have unique firm day observations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;so for example, company a can have the first date as 1/1/2008 and company b can have the first date as 4/15/2010.&lt;/P&gt;&lt;P&gt;i just do a count so that i know for each company what the first day is.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2019 22:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599577#M173095</guid>
      <dc:creator>aaronsterri</dc:creator>
      <dc:date>2019-10-26T22:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: do loop and macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599578#M173096</link>
      <description>&lt;P&gt;It sounds like (please confirm) for each COMPANY:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAY 1 is the earliest DATE for that COMPANY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAY 2 is the next earliest DATE for that COMPANY, even if it falls 5 days after the earliest DATE.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2019 22:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599578#M173096</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-26T22:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: do loop and macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599579#M173097</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;if date is the 366th date, volume=(pseudovolume-psedovolume_lag)+volume at day 1.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think you have explained the desired analysis in any level of completeness so that we can provide an answer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So help me understand this ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 1: what is psedovolume_lag?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 2: What happens on day 731? Is it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;if date is the 731th date, volume=(pseudovolume-psedovolume_lag)+volume at day 1&lt;BR /&gt;or is it&lt;/LI&gt;
&lt;LI&gt;if date is the 731th date, volume=(pseudovolume-psedovolume_lag)+volume at day 366&lt;BR /&gt;or is it&lt;/LI&gt;
&lt;LI&gt;something else?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 3: What do you do about leap years?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 4: what is the desired output for days 1 to 365?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2019 22:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599579#M173097</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-26T22:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: do loop and macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599580#M173098</link>
      <description>&lt;P&gt;You have specified a formula for volume as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; volume(t) &amp;nbsp; = volume(1)&amp;nbsp; + pseudovolume(t) - pseudovolume(t-1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regardless of whether t is the number of days since day 1,&amp;nbsp; of the number of records since record 1, it's a stretch to label this a &lt;EM&gt;&lt;STRONG&gt;rolling&lt;/STRONG&gt;&lt;/EM&gt; value.&amp;nbsp; You're specifying a formula that (for a series beginning in 01jan1990, with 13,000 consecutive dates), means this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; volume(05AUG2025) = volume(01JAN1990) + pseudovolume(05AUG2025) - pseudovolume(04AUG2025)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this what you really want?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2019 22:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-and-macro/m-p/599580#M173098</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-10-26T22:56:11Z</dc:date>
    </item>
  </channel>
</rss>

