<?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: SAS Complex Logic to calculate Volume Benchmark in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384793#M91955</link>
    <description>&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;retain temp;&lt;BR /&gt;if prod="MKT" then temp=vol_bench;&lt;BR /&gt;else vol_bench=temp;&lt;BR /&gt;drop temp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what you meant by complex logic. Please pardon me if I don't understand you&lt;/P&gt;</description>
    <pubDate>Tue, 01 Aug 2017 20:36:18 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2017-08-01T20:36:18Z</dc:date>
    <item>
      <title>SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384790#M91954</link>
      <description>&lt;P&gt;Hello Everyone&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Obs&lt;/TD&gt;&lt;TD&gt;TIMEPERIOD&lt;/TD&gt;&lt;TD&gt;Region&lt;/TD&gt;&lt;TD&gt;Terr_Name&lt;/TD&gt;&lt;TD&gt;PROD&lt;/TD&gt;&lt;TD&gt;METRIC&lt;/TD&gt;&lt;TD&gt;VOL_BENCH&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01-MONTH&lt;/TD&gt;&lt;TD&gt;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t;P&gt;Now, I have the Vol Benchmark for market. I just need to paste it for all the rows unique by given values. Like for example for obs 2,3,4 the value needs to what is obs 1 for market i.e. 1.25. Similarly, for obs 23, 24, 25 and 26 the value needs to be 0.0714. How to use SAS to assign these values? Basically, the rows unique at given level should take the vol_bench of the market.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chandan Mishra&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 20:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384790#M91954</guid>
      <dc:creator>CHAN07</dc:creator>
      <dc:date>2017-08-01T20:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384793#M91955</link>
      <description>&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;retain temp;&lt;BR /&gt;if prod="MKT" then temp=vol_bench;&lt;BR /&gt;else vol_bench=temp;&lt;BR /&gt;drop temp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what you meant by complex logic. Please pardon me if I don't understand you&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 20:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384793#M91955</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-08-01T20:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384797#M91957</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, You understood absolutely correctly. I thought this was complex. Pardon me as I am very new to SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chandan Mishra&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 20:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384797#M91957</guid>
      <dc:creator>CHAN07</dc:creator>
      <dc:date>2017-08-01T20:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384798#M91958</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155624"&gt;@CHAN07&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Please provide sample data via a working SAS data step so we can test code we propose without first having to spend time writing SAS data step code to convert posted data into a SAS data set.&lt;/P&gt;
&lt;P&gt;Below untested code should do what you're after.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  update table have as M
    set 
      m.vol_bench=
        (
          select i.vol_bench
          from have as I
          where 
            i.prod='MKT'
            and i.timeperiod=m.timeperiod
            and i.region=m.region
            and i.terr_name=m.terr_name
            and i.metric=m.metric
          )
      where m.prod ne 'MKT'
    ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Aug 2017 20:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384798#M91958</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-01T20:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384803#M91960</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes I totally understand. Only this time I was not sure how to even proceed. Thanks for sharing your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will make sure I post my SAS code also along with the sample dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chandan Mishra&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 20:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/384803#M91960</guid>
      <dc:creator>CHAN07</dc:creator>
      <dc:date>2017-08-01T20:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385097#M92072</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the error message which I am getting when I am using the code. Can you please double check it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;56 PROC SQL;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;57 UPDATE TABLE HAVE AS M&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;--&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;79&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;76&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ERROR 79-322: Expecting a SET.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;58 SET&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;59 M.VOL_BENCH=&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;60 (SELECT I.VOL_BENCH&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;61 FROM HAVE AS I&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;62 WHERE&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;63 I.PROD = 'MKT'&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;64 AND I.TIMEPERIOD = M.TIMEPERIOD&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;65 AND I.REGION = M.REGION&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;66 AND I.TERR_NAME = M.TERR_NAME&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;67 AND I.METRIC = M.METRIC&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;68 )&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;69 WHERE M.PROD NE "MKT";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;70 QUIT;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;real time 0.02 seconds&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cpu time 0.03 seconds&lt;/STRONG&gt;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;Chandan Mishra&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 19:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385097#M92072</guid>
      <dc:creator>CHAN07</dc:creator>
      <dc:date>2017-08-02T19:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385145#M92098</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155624"&gt;@CHAN07&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Happy to do so if you provide a SAS data step which creates a SAS table with the sample data you've posted.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 22:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385145#M92098</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-02T22:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385148#M92101</link>
      <description>&lt;P&gt;Post code using the {i} menu icon at the top of the message box in this forum to preserve formatting of error messages.&lt;/P&gt;
&lt;P&gt;If the underscore characte is under the "as&amp;nbsp;M" then remove it. I don't think update likes an alias there and expects the SET clause immediately following the table name.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 23:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385148#M92101</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-02T23:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385497#M92223</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created this SAS data step to create the sample data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA HAVE;
	INFILE DATALINES DELIMITER = ',';
	INPUT OBS TIMEPERIOD $ REGION $ TERR $ PROD $ METRIC $ VOL_BENCH;
	DATALINES;
     1,	1-Month,	W,	AT,	MKT,	X,	1.25
     2,	1-Month,	W,	AT,	R,	X,	.
     3,	1-Month,	W,	AT,	F,	X,	.
	4,	1-Month,	W,	AT,	C,	X,	.
	5,	1-Month,	W,	AT,	MKT,	Y,	0.59
	6,	1-Month,	W,	AT,	A,	Y,	.
	7,	1-Month,	W,	AT,	F,	Y,	.
	8,	1-Month,	W,	AT,	R,	Y,	.
	9,	1-Month,	W,	BI,	MKT,	Z,	1.29
	10,	1-Month,	W,	BI,	A, 	Z,	.
	11,	1-Month,	W,	BI,	F,	Z,	.
	12,	1-Month,	W,	BI,	R,	Z,	.
	13,	1-Month,	W,	BI,	C,	Z,	.
	14,	3-Month,	W,	AT,	MKT,	X,	1.58
	15,	3-Month,	W,	AT,	R,	X,	.
	16,	3-Month,	W,	AT,	F,	X,	.
	17,	3-Month,	W,	AT,	C,	X,	.
	18,	3-Month,	W,	AT,	MKT,	Y,	1.68
	19,	3-Month,	W,	AT,	A,	Y,	.
	20,	3-Month,	W,	AT,	F,	Y,	.
	21,	3-Month,	W,	AT,	R,	Y,	.
	22,	3-Month,	W,	BI,	MKT,	Z,	0.23
	23,	3-Month,	W,	BI,	A,	Z,	.
	24,	3-Month,	W,	BI,	F,	Z,	.
	25,	3-Month,	W,	BI,	R,	Z,	.
	26,	3-Month,	W,	BI,	C,	Z,	.


;
RUN;&lt;/PRE&gt;&lt;P&gt;Now when I use the code, it gives the following error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;213  PROC SQL;
214      UPDATE TABLE HAVE
215      SET HAVE.VOL_BENCH=
                 -
                 73
                 76
ERROR 73-322: Expecting an =.

ERROR 76-322: Syntax error, statement will be ignored.

216      (SELECT I.VOL_BENCH
217      FROM HAVE AS I
218      WHERE
219      I.PROD = 'MKT'
220      AND I.TIMEPERIOD = HAVE.TIMEPERIOD
221      AND I.REGION     = HAVE.REGION
222      AND I.TERR_NAME  = HAVE.TERR_NAME
223      AND I.METRIC     = HAVE.METRIC
224      )
225      WHERE HAVE.PROD NE "MKT";
226  QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds



&lt;/PRE&gt;&lt;P&gt;Even when I am using the exact code where I use the alias as M, it gives an error. Please, can you fix it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chandan Mishra&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 20:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385497#M92223</guid>
      <dc:creator>chandan_mishra</dc:creator>
      <dc:date>2017-08-04T20:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385499#M92225</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have updated the problem statement with a data step. Can you please check it on your end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;213  PROC SQL;
214      UPDATE TABLE HAVE
215      SET HAVE.VOL_BENCH=
                 -
                 73
                 76
ERROR 73-322: Expecting an =.

ERROR 76-322: Syntax error, statement will be ignored.

216      (SELECT I.VOL_BENCH
217      FROM HAVE AS I
218      WHERE
219      I.PROD = 'MKT'
220      AND I.TIMEPERIOD = HAVE.TIMEPERIOD
221      AND I.REGION     = HAVE.REGION
222      AND I.TERR_NAME  = HAVE.TERR_NAME
223      AND I.METRIC     = HAVE.METRIC
224      )
225      WHERE HAVE.PROD NE "MKT";
226  QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds



&lt;/PRE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chandan Mishra&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 20:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385499#M92225</guid>
      <dc:creator>chandan_mishra</dc:creator>
      <dc:date>2017-08-04T20:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385782#M92327</link>
      <description>&lt;P&gt;Use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;SET VOL_BENCH=&amp;nbsp;&amp;nbsp; instead of &amp;nbsp;SET HAVE.VOL_BENCH=&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since UPDATE has specified the data set then the variable on the SET to receive the value must already be in the data set. So using a dataset.variable notation is not needed (or allowed).&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2017 22:02:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385782#M92327</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-04T22:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385792#M92330</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/89957"&gt;@chandan_mishra&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Below code works with your sample data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inter;
  set have;
run;

proc sql;
  update have as M
    set 
      vol_bench=
        (
          select i.vol_bench
          from inter as I
          where 
            i.prod='MKT'
            and i.timeperiod=m.timeperiod
            and i.region=m.region
            and i.terr=m.terr
            and i.metric=m.metric
          )
      where m.prod ne 'MKT'
    ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What I've got wrong in my initial post:&lt;/P&gt;
&lt;P&gt;You can't update a SAS table with itself. That's why I had to introduce table &lt;EM&gt;inter&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Aug 2017 00:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/385792#M92330</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-05T00:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Complex Logic to calculate Volume Benchmark</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/386768#M92679</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;Yes this works. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 19:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Complex-Logic-to-calculate-Volume-Benchmark/m-p/386768#M92679</guid>
      <dc:creator>chandan_mishra</dc:creator>
      <dc:date>2017-08-09T19:01:34Z</dc:date>
    </item>
  </channel>
</rss>

