<?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: Solving for x and putting that result in a variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738991#M230595</link>
    <description>Oh god I was so caught up in trying to solve for x using the formula given to me I didn’t even think about rewriting it. I’m so dumb. Thank you so much!!&lt;BR /&gt;</description>
    <pubDate>Tue, 04 May 2021 17:29:56 GMT</pubDate>
    <dc:creator>mitrakos</dc:creator>
    <dc:date>2021-05-04T17:29:56Z</dc:date>
    <item>
      <title>Solving for x and putting that result in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738988#M230592</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have a dataset where I am trying to solve for X and then put that X value in a new variable. Below is a sample, with the missing value being X.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input A S P C B;
datalines;
200 100 200 50 .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The equation is: A = (S + P) - (C + B).&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, B is the X we're solving for. We know that B = 50 in this case since it's a simple equation but the real dataset has thousands of rows and more complicated numbers unfortunately. Is there any way I can have SAS solve for B, and then put that value of B on a new variable?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 17:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738988#M230592</guid>
      <dc:creator>mitrakos</dc:creator>
      <dc:date>2021-05-04T17:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Solving for x and putting that result in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738989#M230593</link>
      <description>&lt;P&gt;Are you asking for SAS to convert the assignment statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;A = (S + P) - (C + B);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Into an assignment statement with B as the target?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not just perform the re-write yourself?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* start :
A = (S + P) - (C + B);
* remove () ;
A = S + P - C - B;  
* add B to both sides ;
A+B = S + P - C ;
* subtract A from both sides;
B = S + P - C - A;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your real problem is more complex then perhaps you need PROC IML or PROC NLIN?&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 17:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738989#M230593</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-04T17:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Solving for x and putting that result in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738991#M230595</link>
      <description>Oh god I was so caught up in trying to solve for x using the formula given to me I didn’t even think about rewriting it. I’m so dumb. Thank you so much!!&lt;BR /&gt;</description>
      <pubDate>Tue, 04 May 2021 17:29:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Solving-for-x-and-putting-that-result-in-a-variable/m-p/738991#M230595</guid>
      <dc:creator>mitrakos</dc:creator>
      <dc:date>2021-05-04T17:29:56Z</dc:date>
    </item>
  </channel>
</rss>

