<?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: creating a new column in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85548#M3147</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Column A denotes the dates.&lt;/P&gt;&lt;P&gt;Column B denotes stock returns and&lt;/P&gt;&lt;P&gt;Column C has some estimated variances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to divide entries in Column B by entries in column C like I have explained in a previous reply and store the new values in a newly created column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that is what you need to know right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2013 16:19:18 GMT</pubDate>
    <dc:creator>malakaext</dc:creator>
    <dc:date>2013-01-29T16:19:18Z</dc:date>
    <item>
      <title>creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85540#M3139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached excel sheet contains two columns. I need to create a new column such that first 30 entries of the new column is the productS of the first 30 entries of column 1 and the 1ts entry of column 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next 30 entries of the new column are the productS of the next 30 entries of column 1 with the 2nd entry of column 2 and so on..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can some one help me with this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 22:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85540#M3139</guid>
      <dc:creator>malakaext</dc:creator>
      <dc:date>2013-01-24T22:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85541#M3140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you could use _n_ in a data step which gives you the row number. And then read the value of column2 for each 31st row. And keep it in mind. So that you can multiplicate each of the 30 rows in column1 with this value. I guess that's what you ask for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say your columns are called var1 and var2 and you create var3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* get access to the excel file */&lt;/P&gt;&lt;P&gt;libname libxls 'c:\temp\mydata.xls';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.myoutput;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set libxls.'mysheet$'n; /* get acces to one excel sheet */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if mod(_n_,30)+1 = 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('b',var2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var3 = var1 * symget('b');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname libxls clear;&lt;/P&gt;&lt;P&gt;[untested code - can you work with that?]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 17:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85541#M3140</guid>
      <dc:creator>Eva</dc:creator>
      <dc:date>2013-01-25T17:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85542#M3141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain the "mod" part a little bit more please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also if i need to call entries in a column one by one (inside a loop) how could I change this code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 00:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85542#M3141</guid>
      <dc:creator>malakaext</dc:creator>
      <dc:date>2013-01-29T00:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85543#M3142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For mod() see here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/viewer.htm#langref_sect173.htm"&gt;http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/viewer.htm#langref_sect173.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It gives you the rest of a division. In my example it gives you every 31st row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you mean with your second sentence? Do you have an example?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 07:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85543#M3142</guid>
      <dc:creator>Eva</dc:creator>
      <dc:date>2013-01-29T07:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85544#M3143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me explain the real problem I am having.&lt;/P&gt;&lt;P&gt;In the attached sheet I have 3 columns A B C.&lt;/P&gt;&lt;P&gt;Column A has dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I wanted to do was to: &lt;/P&gt;&lt;P&gt;divide the entries in column B corresponding to week 2 of that year&amp;nbsp; by the 1st entry in Column C. (Dates start with week 2)&lt;/P&gt;&lt;P&gt;divide the entries in column B corresponding to week 3 of that year&amp;nbsp; by the 2nd entry in Column C.&lt;/P&gt;&lt;P&gt;divide the entries in column B corresponding to week 4 of that year&amp;nbsp; by the 3rd entry in Column C and so on..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was trying to use a code similar to the one in my original post but since some weeks don't have 5 entries for each week and the 'year' comes important I guess that method won't work.&lt;/P&gt;&lt;P&gt;I think I need to use a couple of do loops with 'if year=' and 'If week='&amp;nbsp; commands but I don't have that much experience to write a code for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is the main reason I asked for help from you. I know this part of the code has nothing to do with GRAPHING. However, I have to do a lot plotting once I get this correct and also this community is very active and really helpful. That is why I posted this question in this section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really appreciate your input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 15:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85544#M3143</guid>
      <dc:creator>malakaext</dc:creator>
      <dc:date>2013-01-29T15:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85545#M3144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have flexibility in creating the spreadsheet?&amp;nbsp; It would be much easier if you aligned the entries in column c to the date ranges you need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 15:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85545#M3144</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-01-29T15:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85546#M3145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually tried to do the whole thing in excel last night. It was really painful to do it manually as I have so many data points(more than 2000) in column B. That's why I wanted to write a &lt;STRONG&gt;GENERAL SAS&lt;/STRONG&gt; &lt;STRONG&gt;CODE&lt;/STRONG&gt; so I can do it to any data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 15:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85546#M3145</guid>
      <dc:creator>malakaext</dc:creator>
      <dc:date>2013-01-29T15:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85547#M3146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post what your data looks like and what you WANT to get out of it. I think what you want is relatively simple, but you'll need to join the dataset back to itself with SQL and then do you calculations. &lt;BR /&gt;I'd rather make sure before I try anything though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 16:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85547#M3146</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-29T16:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85548#M3147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Column A denotes the dates.&lt;/P&gt;&lt;P&gt;Column B denotes stock returns and&lt;/P&gt;&lt;P&gt;Column C has some estimated variances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to divide entries in Column B by entries in column C like I have explained in a previous reply and store the new values in a newly created column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that is what you need to know right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 16:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85548#M3147</guid>
      <dc:creator>malakaext</dc:creator>
      <dc:date>2013-01-29T16:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85549#M3148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please post some example data with the example output. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 16:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85549#M3148</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-29T16:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new column</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85550#M3149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am really sorry but all I have is the data given in the attached csv file named "help.csv".&lt;/P&gt;&lt;P&gt;Is that what you are looking for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attache the data set to this reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 16:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/creating-a-new-column/m-p/85550#M3149</guid>
      <dc:creator>malakaext</dc:creator>
      <dc:date>2013-01-29T16:33:53Z</dc:date>
    </item>
  </channel>
</rss>

