<?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: How to create a variable as a function of 2 parameters and three other variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/419939#M280565</link>
    <description>&lt;P&gt;Yes.&amp;nbsp; Change '[' to '(', ']' to ')', '^' to '**', and put a semicolon at the end and you have a DATA step assignment statement.&amp;nbsp; Be sure to assign values to your other variables by using other assignment statements.&amp;nbsp; You can use IML, but&amp;nbsp;a DATA step is a tiny bit easier for something like this.&lt;/P&gt;</description>
    <pubDate>Sun, 10 Dec 2017 17:21:05 GMT</pubDate>
    <dc:creator>WarrenKuhfeld</dc:creator>
    <dc:date>2017-12-10T17:21:05Z</dc:date>
    <item>
      <title>How to create a variable as a function of 2 parameters and three other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/419934#M280564</link>
      <description>&lt;P&gt;Dear Friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are trying to create a three-dimensional plot of a variable – residsq - that is a function of two parameters.&amp;nbsp; The two parameters are sigma_T and sigma_Z.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Essentially, the two parameters will lie on the x and y axis and residsq will lie on z-axis. The two parameters are sigma_T and sigma_Z and we want them to vary from 0.1 to 10, in increments of 0.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note this is not a question about plotting it is about how to generate a variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition to the two parameters, residsq is a function of three variables that form a dataset of 14,000 observations. &amp;nbsp;The variables are ret, uep, and tq.&amp;nbsp; These variables are clearly fixed and are constant for different permutations of sigma_T and sigma_Z.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;residsq has the following form:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;residsq = [ret – (1 – 0.5*(sigma_T/1.0)) *uep – ((sigma_T*sqrt(1 – 0.5^2)))/sigma_Z)*tq]^2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our output should look like this 3 column matrix:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sigma_T&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sigma_Z&amp;nbsp;&amp;nbsp;&amp;nbsp; residsq&lt;/P&gt;&lt;P&gt;0.1&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; 0.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ?&lt;/P&gt;&lt;P&gt;0.2&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; 0.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ?&lt;/P&gt;&lt;P&gt;0.3&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;0.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&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;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;10.0&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; 0.1&lt;/P&gt;&lt;P&gt;0.1&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; 0.2&lt;/P&gt;&lt;P&gt;0.2&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; 0.2&lt;/P&gt;&lt;P&gt;0.3&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;0.2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.10.0&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; 0.2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this in a data step or in proc iml?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Srinivasan&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 16:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/419934#M280564</guid>
      <dc:creator>srinirangan123</dc:creator>
      <dc:date>2017-12-10T16:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable as a function of 2 parameters and three other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/419939#M280565</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; Change '[' to '(', ']' to ')', '^' to '**', and put a semicolon at the end and you have a DATA step assignment statement.&amp;nbsp; Be sure to assign values to your other variables by using other assignment statements.&amp;nbsp; You can use IML, but&amp;nbsp;a DATA step is a tiny bit easier for something like this.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 17:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/419939#M280565</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-12-10T17:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable as a function of 2 parameters and three other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/420001#M280566</link>
      <description>&lt;P&gt;Thanks a lot Warren!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, the problem is that parameters sigma_F and sigma_T are not scalar constants.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like each of them range from 0.1 to 10 in increments of 0.1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That means that they can each take 100 values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In combination, I would 100 times 100 = 10,000 values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So&amp;nbsp; essentially, I would like to create 10,000 values of the residsq vector (dimension 14,000 by 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will then sum each of these 10,000 vectors to create 10,000 values of residq that correspond to each of the 10,000 combinations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I think a do loop would be needed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 03:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/420001#M280566</guid>
      <dc:creator>srinirangan123</dc:creator>
      <dc:date>2017-12-11T03:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable as a function of 2 parameters and three other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/420182#M280567</link>
      <description>&lt;P&gt;Something with a pair of nested loops perhaps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have; /* assumes this is where the values for uep reside if not the statements like UEP = */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; do sigma_T = 0.1 to 10 by 0.1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do sigma_F = 0.1 to 10 by 0.1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;formula goes here&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/420182#M280567</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-11T16:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable as a function of 2 parameters and three other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/420884#M280568</link>
      <description>&lt;P&gt;Thanks a lot Ballardw.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That worked really well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate it.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 16:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-variable-as-a-function-of-2-parameters-and-three/m-p/420884#M280568</guid>
      <dc:creator>srinirangan123</dc:creator>
      <dc:date>2017-12-13T16:27:21Z</dc:date>
    </item>
  </channel>
</rss>

