<?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: Reading a value in a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334885#M272291</link>
    <description>&lt;P&gt;Please clarify your post highlighting what you have, what you want and what you've done so far, if you have code.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 10:51:40 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-02-22T10:51:40Z</dc:date>
    <item>
      <title>Reading a value in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334879#M272290</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to read a specific value in variable &amp;nbsp;and use it to divide the rest of the values to find a new value. Here's my variable list:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Price&lt;/P&gt;&lt;P&gt;3.85&amp;nbsp;&lt;BR /&gt;5.1&amp;nbsp;&lt;BR /&gt;22&lt;/P&gt;&lt;P&gt;3.95&lt;/P&gt;&lt;P&gt;6.3&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;3.3&amp;nbsp;&lt;/P&gt;&lt;P&gt;3211&amp;nbsp;&lt;BR /&gt;30&lt;BR /&gt;6.35&amp;nbsp;&lt;BR /&gt;55&lt;/P&gt;&lt;P&gt;39.2&lt;/P&gt;&lt;P&gt;So I have to read the first value i.e. 3.85&lt;/P&gt;&lt;P&gt;and create a new variable Pur_power&lt;/P&gt;&lt;P&gt;data_null_&lt;/P&gt;&lt;P&gt;set econs;&lt;/P&gt;&lt;P&gt;pur_power = price/ &lt;STRONG&gt;read value (3.85) - unable to do this&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can please someone help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 10:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334879#M272290</guid>
      <dc:creator>Syeda35</dc:creator>
      <dc:date>2017-02-22T10:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a value in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334885#M272291</link>
      <description>&lt;P&gt;Please clarify your post highlighting what you have, what you want and what you've done so far, if you have code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 10:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334885#M272291</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-22T10:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a value in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334894#M272292</link>
      <description>&lt;P&gt;What I have: Below dataset &lt;STRONG&gt;(line 5)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What I have done so far: the code is mentioned&lt;/P&gt;&lt;P&gt;What I want to do: create a new variable PPD and calculate the value using the formula below &lt;STRONG&gt;(line 9)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. data economist;&lt;BR /&gt;2. infile datalines;&lt;BR /&gt;3. input country$:15. currency$ local_Mc xchangrt;&lt;BR /&gt;4. datalines;&lt;BR /&gt;5. United_States US$ 2.65 1&lt;BR /&gt;Argentina Peso 3.85 2.9931&lt;BR /&gt;Australia A$ 3.2 1.2979&lt;BR /&gt;Brazil Real 4.5 2.934&lt;BR /&gt;Britain £ 1.99 0.5424&lt;BR /&gt;Canada C$ 3.2 1.3286&lt;BR /&gt;China Yuan 9.95 8.2873&lt;BR /&gt;Euro_area € 2.75 0.7921&lt;BR /&gt;Hong_Kong HK$ 11.25 7.7741&lt;BR /&gt;Hungary Forint 492 210.83&lt;BR /&gt;Indonesia Rupiah 16155 8458&lt;BR /&gt;Japan ¥ 263 105.74&lt;BR /&gt;Malaysia M$ 5.1 3.7916&lt;BR /&gt;Mexico Peso 22 11.186&lt;BR /&gt;New_Zealand NZ$ 3.95 1.4415&lt;BR /&gt;Poland Zloty 6.3 3.8447&lt;BR /&gt;Russia Rouble 40 28.54&lt;BR /&gt;Singapore s$ 3.3 1.6853&lt;BR /&gt;South_Africa Rand 14.05 7.0302&lt;BR /&gt;South_Korea Won 3211 1174.4&lt;BR /&gt;Sweden SKr 30 7.23&lt;BR /&gt;Switzerland SFr 6.35 1.2416&lt;BR /&gt;Taiwan NT$ 70.55 33.22&lt;BR /&gt;Thailand Baht 55 39.232&lt;BR /&gt;;&lt;BR /&gt;6. run;&lt;/P&gt;&lt;P&gt;7. data _null_;&lt;BR /&gt;8.set work.economist;&lt;BR /&gt;9. PPD = local_Mc/ first.local.Mc; *&lt;STRONG&gt;(to read the first value in variable local_Mc and divide each value in local_Mc and create a new variable PPD/;&lt;/STRONG&gt;&lt;BR /&gt;valuation=((PPD-xchangrt)/xchangrt)*100&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*Error - first.local.Mc not initialized;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this clarfies.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 11:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334894#M272292</guid>
      <dc:creator>Syeda35</dc:creator>
      <dc:date>2017-02-22T11:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a value in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334901#M272293</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ppd;
   if _n_ eq 1 then set economist(keep=local_mc rename=(local_mc=first_local_mc)); *(to read the first value in variable local_Mc);
   set work.economist;
   PPD = divide(local_Mc,first_local_Mc); *(divide each value in local_Mc and create a new variable PPD);
   valuation=((PPD-xchangrt)/xchangrt)*100;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2017 11:55:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334901#M272293</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-02-22T11:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a value in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334904#M272294</link>
      <description>&lt;P&gt;Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-value-in-a-variable/m-p/334904#M272294</guid>
      <dc:creator>Syeda35</dc:creator>
      <dc:date>2017-02-22T12:00:03Z</dc:date>
    </item>
  </channel>
</rss>

