<?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 new to array in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103749#M29029</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am trying to get the hang of arrays and having trouble.&amp;nbsp; The below code is intended to take current weight and get a goal weight.&amp;nbsp; Instead of doing that I am adding two variables and not calculating goal weight.&amp;nbsp; If anyone can see the errors and advise I would appreciate it.&amp;nbsp; Thanks:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data start;&lt;/P&gt;&lt;P&gt;infile datalines;&lt;/P&gt;&lt;P&gt;input name $ sex $ weight1 weight2;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;sara f 120 119&lt;/P&gt;&lt;P&gt;bill m 220 219&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data end (drop=i);&lt;/P&gt;&lt;P&gt;set start;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array start_array{*} _numeric_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array end_array{*} goal_weight1-goal_weight2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if sex=f then do&lt;/P&gt;&lt;P&gt;&amp;nbsp; i=1 to 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end_array{i}=start_array{i}*.95;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if sex=m then do&lt;/P&gt;&lt;P&gt;&amp;nbsp; i=1 to 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end_array{i}=start_array{i}*.9;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Feb 2013 20:29:53 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2013-02-08T20:29:53Z</dc:date>
    <item>
      <title>new to array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103749#M29029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am trying to get the hang of arrays and having trouble.&amp;nbsp; The below code is intended to take current weight and get a goal weight.&amp;nbsp; Instead of doing that I am adding two variables and not calculating goal weight.&amp;nbsp; If anyone can see the errors and advise I would appreciate it.&amp;nbsp; Thanks:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data start;&lt;/P&gt;&lt;P&gt;infile datalines;&lt;/P&gt;&lt;P&gt;input name $ sex $ weight1 weight2;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;sara f 120 119&lt;/P&gt;&lt;P&gt;bill m 220 219&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data end (drop=i);&lt;/P&gt;&lt;P&gt;set start;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array start_array{*} _numeric_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array end_array{*} goal_weight1-goal_weight2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if sex=f then do&lt;/P&gt;&lt;P&gt;&amp;nbsp; i=1 to 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end_array{i}=start_array{i}*.95;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if sex=m then do&lt;/P&gt;&lt;P&gt;&amp;nbsp; i=1 to 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end_array{i}=start_array{i}*.9;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 20:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103749#M29029</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2013-02-08T20:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: new to array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103750#M29030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if you have other issues with the code, but is it supposed to be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sex=&lt;STRONG style="font-size: 12pt;"&gt;'f'&lt;/STRONG&gt; then do&lt;/P&gt;&lt;P&gt;else if sex=&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;'m'&lt;/STRONG&gt;&lt;/SPAN&gt; then do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 21:02:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103750#M29030</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-02-08T21:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: new to array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103751#M29031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only prroblem I see is the absence of quotes around &lt;EM&gt;f&lt;/EM&gt; and &lt;EM&gt;m&lt;/EM&gt; in your if statements. PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 21:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103751#M29031</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-02-08T21:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: new to array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103752#M29032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Other than the missing quotes around the string literals and the strange indentation the program looks fine.&lt;/P&gt;&lt;P&gt;It is converting the existing weights to goal weights by multiplying by a fraction that depends on gender.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What did you want to do differently?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goal_&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goal_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; name&amp;nbsp;&amp;nbsp;&amp;nbsp; sex&amp;nbsp;&amp;nbsp;&amp;nbsp; weight1&amp;nbsp;&amp;nbsp;&amp;nbsp; weight2&amp;nbsp;&amp;nbsp;&amp;nbsp; weight1&amp;nbsp;&amp;nbsp;&amp;nbsp; weight2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sara&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 120&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 119&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 114&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 113.05&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bill&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 220&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 219&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 198&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 197.10&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 21:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103752#M29032</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-02-08T21:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: new to array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103753#M29033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; In answer to your more general question about arrays, I have always found this to be a good paper.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/rnd/papers/sgf07/arrays1780.pdf" title="http://support.sas.com/rnd/papers/sgf07/arrays1780.pdf"&gt;http://support.sas.com/rnd/papers/sgf07/arrays1780.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; But, as you learned, the problem was not so much with array processing as IF statement syntax and the need for quoting character strings in comparisons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2013 23:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/new-to-array/m-p/103753#M29033</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-02-08T23:14:47Z</dc:date>
    </item>
  </channel>
</rss>

