<?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: calculation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502018#M133955</link>
    <description>thanks for replying, but there are still no value in imomf column. permno doesnt matter.</description>
    <pubDate>Fri, 05 Oct 2018 18:52:50 GMT</pubDate>
    <dc:creator>Songchan</dc:creator>
    <dc:date>2018-10-05T18:52:50Z</dc:date>
    <item>
      <title>calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501939#M133911</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use the data (please see the photo) to calculate a factor, the formula is&amp;nbsp;imomf=1/2*(bw+sw)-1/2*(bl+sl), but the thing is i need bw, sw, bl and sl 's corresponding imom statistics to calculate imomf, and i need it sorted by date, so that on each date i get one imomf.&lt;/P&gt;&lt;P&gt;Could somebody help me with that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp01; set mylib.rankimom01;
    keep permno date imom kind;
run;

proc sort data=temp01;by date;run;
data temp02; set temp01;
   imomf=1/2*(bw+sw)-1/2*(bl+sl);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="photo.png" style="width: 428px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23813i79E743434E3E00E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="photo.png" alt="photo.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501939#M133911</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2018-10-05T15:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501944#M133914</link>
      <description>&lt;P&gt;First, you need to post your data as SAS code (see this document for instructions: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;) rather than as a photo, which we can't use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Secondly,&amp;nbsp;since you don't have variables bl, sl, bw and sw, your code won't work. Can you tell us where these variables come from? How would YOU create these variables?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501944#M133914</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-05T15:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501965#M133926</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for reply, the photo is just an example, I only want you to know what it looks like, and there are four kinds of data in "kind" column, bw, bl, sw, sl. I didn't show them all in the photo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:55:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501965#M133926</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2018-10-05T15:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501967#M133928</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp03; set temp02;
   if rank=1 and size='b' then kind='bl';
   if rank=1 and size='s' then kind='sl';
   if rank=10 and size='b' then kind='bw';
   if rank=10 and size='s' then kind='sw';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/501967#M133928</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2018-10-05T15:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502001#M133946</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230936"&gt;@Songchan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for reply, the photo is just an example, I only want you to know what it looks like, and there are four kinds of data in "kind" column, bw, bl, sw, sl. I didn't show them all in the photo.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Again, we need to see a reasonable portion of the data so we can understand what to do. If your example only shows bl as a character string and not any of the others, how are we supposed to make progress? If there are four different kinds of data in the column "kind", that should have been clearly stated in the original message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now please explain what we should do with PERMNO? What is the aggregation method for multiple observations in a given value of DATE1?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 17:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502001#M133946</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-05T17:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502011#M133952</link>
      <description>&lt;P&gt;It looks like you are only missing a transposition step. Perhaps:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp01; set mylib.rankimom01;
    keep permno date imom kind;
run;

proc sort data=temp01;by permno date;run;

proc transpose data=temp01 out=temp02;
by permno date;
var imom;
id kind;
run;

data temp03; set temp02;
   imomf=1/2*(bw+sw)-1/2*(bl+sl);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not sure about the role of permno. Untested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 18:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502011#M133952</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-05T18:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502018#M133955</link>
      <description>thanks for replying, but there are still no value in imomf column. permno doesnt matter.</description>
      <pubDate>Fri, 05 Oct 2018 18:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502018#M133955</guid>
      <dc:creator>Songchan</dc:creator>
      <dc:date>2018-10-05T18:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502023#M133956</link>
      <description>&lt;P&gt;Remove permno from the code and see what happens.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 19:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502023#M133956</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-05T19:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: calculation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502103#M133984</link>
      <description>&lt;P&gt;You still haven't described what we should do about the multiple values with the same date. What should we do about this? Average the values with the same date? Sum the values with the same date?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Oct 2018 11:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculation/m-p/502103#M133984</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-06T11:40:10Z</dc:date>
    </item>
  </channel>
</rss>

