<?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 do I create new variables from old ones in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501652#M133790</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226541"&gt;@JUMMY&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So I have this data that contains so many numerical variables. I want to create a new variable from two of the variables such that 1="any fracture" and 2="non fracture" but the new variable should be numerical. How do I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs studyid sdem idem female age sanyapcnsrx santipsychrx scnsrx sconven satypical sbenzo&lt;/P&gt;
&lt;P&gt;1 M0001 1 yes yes 85.6016 33 15 33 0 15 3&lt;BR /&gt;2 M0002 6 yes no 93.3580 1 0 1 0 0 1&lt;BR /&gt;3 M0003 1 yes yes 86.6146 45 0 45 0 0 9&lt;BR /&gt;4 M0007 5 yes yes 74.8720 8 2 8 0 2 0&lt;BR /&gt;5 M0008 1 yes no 83.5975 5 0 5 0 0 2&lt;BR /&gt;6 M0010 34 yes yes 77.2402 8 2 8 0 2 1&lt;BR /&gt;7 M0011 1 yes yes 79.5400 0 0 0 0 0 0&lt;BR /&gt;8 M0014 1 yes yes 78.7543 4 0 4 0 0 0&lt;BR /&gt;9 M0016 3 yes no 62.7105 58 0 58 0 0 0&lt;BR /&gt;10 M0018 8 yes no 70.3792 8 3 8 0 3 0&lt;BR /&gt;11 M0020 1 yes yes 49.3908 1 0 1 0 0 0&lt;BR /&gt;12 M0022 4 yes no 85.2923 76 2 76 0 2 1&lt;BR /&gt;13 M0025 1 yes no 78.8611 10 0 10 0 0 2&lt;BR /&gt;14 M0028 8 yes yes 74.3053 13 0 13 0 0 0&lt;BR /&gt;15 M0035 2 yes yes 74.6831 33 0 33 0 0 1&lt;BR /&gt;16 M0036 1 yes yes 54.5243 72 12 72 1 11 6&lt;BR /&gt;17 M0041 1 yes yes 87.5044 3 0 3 0 0 0&lt;BR /&gt;18 M0044 6 yes yes 71.0609 18 0 18 0 0 1&lt;BR /&gt;19 M0047 14 yes yes 81.0924 49 20 49 0 20 1&lt;BR /&gt;20 M0056 5 yes yes 80.7064 61 0 61 0 0 40&lt;BR /&gt;21 M0058 1 yes yes 47.4470 29 0 29 0 0 0&lt;BR /&gt;22 M0060 1 yes no 84.7474 101 0 101 0 0 0&lt;BR /&gt;23 M0062 1 yes no 51.1239 29 0 29 0 0 0&lt;BR /&gt;24 M0065 8 yes yes 76.4873 1 0 1 0 0 0&lt;BR /&gt;25 M0070 3 yes yes 60.9035 62 0 62 0 0 1&lt;BR /&gt;26 M0074 10 yes no 59.3018 61 8 61 0 8 26&lt;BR /&gt;27 M0079 1 yes no 78.0616 17 0 17 0 0 0&lt;BR /&gt;28 M0080 1 yes yes 80.8816 2 0 2 0 0 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So say I want to create a new variable from "sanyapcnsrx" and "santipsychrx" using 1='any fracture' and 0='non fracture' such that I can run proc means. What do I do?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For obs=1 your sanyapcnsrx variable is 33 and santipsychrx is 15. HOW do we know from the values of the two variables whether this is a "any fracture" or "non fracture"? We need to know the rules for identifying the condition our are requesting/&lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2018 18:50:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-10-04T18:50:28Z</dc:date>
    <item>
      <title>How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501612#M133767</link>
      <description>&lt;P&gt;So I have this data that contains so many numerical variables. I want to create a new variable from two of the variables such that 1="any fracture" and 2="non fracture" but the new variable should be numerical. How do I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs studyid sdem idem female age sanyapcnsrx santipsychrx scnsrx sconven satypical sbenzo&lt;/P&gt;&lt;P&gt;1 M0001 1 yes yes 85.6016 33 15 33 0 15 3&lt;BR /&gt;2 M0002 6 yes no 93.3580 1 0 1 0 0 1&lt;BR /&gt;3 M0003 1 yes yes 86.6146 45 0 45 0 0 9&lt;BR /&gt;4 M0007 5 yes yes 74.8720 8 2 8 0 2 0&lt;BR /&gt;5 M0008 1 yes no 83.5975 5 0 5 0 0 2&lt;BR /&gt;6 M0010 34 yes yes 77.2402 8 2 8 0 2 1&lt;BR /&gt;7 M0011 1 yes yes 79.5400 0 0 0 0 0 0&lt;BR /&gt;8 M0014 1 yes yes 78.7543 4 0 4 0 0 0&lt;BR /&gt;9 M0016 3 yes no 62.7105 58 0 58 0 0 0&lt;BR /&gt;10 M0018 8 yes no 70.3792 8 3 8 0 3 0&lt;BR /&gt;11 M0020 1 yes yes 49.3908 1 0 1 0 0 0&lt;BR /&gt;12 M0022 4 yes no 85.2923 76 2 76 0 2 1&lt;BR /&gt;13 M0025 1 yes no 78.8611 10 0 10 0 0 2&lt;BR /&gt;14 M0028 8 yes yes 74.3053 13 0 13 0 0 0&lt;BR /&gt;15 M0035 2 yes yes 74.6831 33 0 33 0 0 1&lt;BR /&gt;16 M0036 1 yes yes 54.5243 72 12 72 1 11 6&lt;BR /&gt;17 M0041 1 yes yes 87.5044 3 0 3 0 0 0&lt;BR /&gt;18 M0044 6 yes yes 71.0609 18 0 18 0 0 1&lt;BR /&gt;19 M0047 14 yes yes 81.0924 49 20 49 0 20 1&lt;BR /&gt;20 M0056 5 yes yes 80.7064 61 0 61 0 0 40&lt;BR /&gt;21 M0058 1 yes yes 47.4470 29 0 29 0 0 0&lt;BR /&gt;22 M0060 1 yes no 84.7474 101 0 101 0 0 0&lt;BR /&gt;23 M0062 1 yes no 51.1239 29 0 29 0 0 0&lt;BR /&gt;24 M0065 8 yes yes 76.4873 1 0 1 0 0 0&lt;BR /&gt;25 M0070 3 yes yes 60.9035 62 0 62 0 0 1&lt;BR /&gt;26 M0074 10 yes no 59.3018 61 8 61 0 8 26&lt;BR /&gt;27 M0079 1 yes no 78.0616 17 0 17 0 0 0&lt;BR /&gt;28 M0080 1 yes yes 80.8816 2 0 2 0 0 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So say I want to create a new variable from "sanyapcnsrx" and "santipsychrx" using 1='any fracture' and 0='non fracture' such that I can run proc means. What do I do?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501612#M133767</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2018-10-04T18:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501616#M133770</link>
      <description>&lt;P&gt;why not just format is using proc format without having to create a new variable?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 17:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501616#M133770</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-04T17:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501618#M133772</link>
      <description>the problem is that I want to find proc means. How do i do that with character variables if i decide to use proc format?</description>
      <pubDate>Thu, 04 Oct 2018 17:46:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501618#M133772</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2018-10-04T17:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501621#M133774</link>
      <description>&lt;P&gt;Can you post a sample of what you have and what you want explaining the current data type of the vars&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 17:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501621#M133774</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-04T17:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501631#M133777</link>
      <description>&lt;P&gt;PROC FORMAT leaves the variables as numeric, if they were numeric to begin with, so you can do math on them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, please, show us a portion of your data.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 17:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501631#M133777</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-04T17:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501635#M133779</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, I just posted some data above. So say I want to create a new variable from "sanyapcnsrx" and "santipsychrx" using 1='any fracture' and 0='non fracture' such that I can run proc means. What do I do?</description>
      <pubDate>Thu, 04 Oct 2018 18:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501635#M133779</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2018-10-04T18:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501637#M133780</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226541"&gt;@JUMMY&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So I have this data that contains so many numerical variables. I want to create a new variable from two of the variables such that 1="any fracture" and 2="non fracture" but the new variable should be numerical. How do I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs studyid sdem idem female age sanyapcnsrx santipsychrx scnsrx sconven satypical sbenzo&lt;/P&gt;
&lt;P&gt;1 M0001 1 yes yes 85.6016 33 15 33 0 15 3&lt;BR /&gt;2 M0002 6 yes no 93.3580 1 0 1 0 0 1&lt;BR /&gt;3 M0003 1 yes yes 86.6146 45 0 45 0 0 9&lt;BR /&gt;4 M0007 5 yes yes 74.8720 8 2 8 0 2 0&lt;BR /&gt;5 M0008 1 yes no 83.5975 5 0 5 0 0 2&lt;BR /&gt;6 M0010 34 yes yes 77.2402 8 2 8 0 2 1&lt;BR /&gt;7 M0011 1 yes yes 79.5400 0 0 0 0 0 0&lt;BR /&gt;8 M0014 1 yes yes 78.7543 4 0 4 0 0 0&lt;BR /&gt;9 M0016 3 yes no 62.7105 58 0 58 0 0 0&lt;BR /&gt;10 M0018 8 yes no 70.3792 8 3 8 0 3 0&lt;BR /&gt;11 M0020 1 yes yes 49.3908 1 0 1 0 0 0&lt;BR /&gt;12 M0022 4 yes no 85.2923 76 2 76 0 2 1&lt;BR /&gt;13 M0025 1 yes no 78.8611 10 0 10 0 0 2&lt;BR /&gt;14 M0028 8 yes yes 74.3053 13 0 13 0 0 0&lt;BR /&gt;15 M0035 2 yes yes 74.6831 33 0 33 0 0 1&lt;BR /&gt;16 M0036 1 yes yes 54.5243 72 12 72 1 11 6&lt;BR /&gt;17 M0041 1 yes yes 87.5044 3 0 3 0 0 0&lt;BR /&gt;18 M0044 6 yes yes 71.0609 18 0 18 0 0 1&lt;BR /&gt;19 M0047 14 yes yes 81.0924 49 20 49 0 20 1&lt;BR /&gt;20 M0056 5 yes yes 80.7064 61 0 61 0 0 40&lt;BR /&gt;21 M0058 1 yes yes 47.4470 29 0 29 0 0 0&lt;BR /&gt;22 M0060 1 yes no 84.7474 101 0 101 0 0 0&lt;BR /&gt;23 M0062 1 yes no 51.1239 29 0 29 0 0 0&lt;BR /&gt;24 M0065 8 yes yes 76.4873 1 0 1 0 0 0&lt;BR /&gt;25 M0070 3 yes yes 60.9035 62 0 62 0 0 1&lt;BR /&gt;26 M0074 10 yes no 59.3018 61 8 61 0 8 26&lt;BR /&gt;27 M0079 1 yes no 78.0616 17 0 17 0 0 0&lt;BR /&gt;28 M0080 1 yes yes 80.8816 2 0 2 0 0 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So say I want to create a new variable from "sanyapcnsrx" and "santipsychrx" using 1='any fracture' and 0='non fracture' such that I can run proc means. What do I do?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm afraid this doesn't tell us anything. You want to "create a new variable"? How? What do you want to do to create this new variable? Add them together? Divide them? Add the arccosines squared? Explain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226541"&gt;@JUMMY&lt;/a&gt;, from now on, we expect you to post sample data every single post you make, using this method:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; because the data you did post is unbelievably difficult for humans to read.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501637#M133780</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-10-04T18:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variables from old ones</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501652#M133790</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226541"&gt;@JUMMY&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So I have this data that contains so many numerical variables. I want to create a new variable from two of the variables such that 1="any fracture" and 2="non fracture" but the new variable should be numerical. How do I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obs studyid sdem idem female age sanyapcnsrx santipsychrx scnsrx sconven satypical sbenzo&lt;/P&gt;
&lt;P&gt;1 M0001 1 yes yes 85.6016 33 15 33 0 15 3&lt;BR /&gt;2 M0002 6 yes no 93.3580 1 0 1 0 0 1&lt;BR /&gt;3 M0003 1 yes yes 86.6146 45 0 45 0 0 9&lt;BR /&gt;4 M0007 5 yes yes 74.8720 8 2 8 0 2 0&lt;BR /&gt;5 M0008 1 yes no 83.5975 5 0 5 0 0 2&lt;BR /&gt;6 M0010 34 yes yes 77.2402 8 2 8 0 2 1&lt;BR /&gt;7 M0011 1 yes yes 79.5400 0 0 0 0 0 0&lt;BR /&gt;8 M0014 1 yes yes 78.7543 4 0 4 0 0 0&lt;BR /&gt;9 M0016 3 yes no 62.7105 58 0 58 0 0 0&lt;BR /&gt;10 M0018 8 yes no 70.3792 8 3 8 0 3 0&lt;BR /&gt;11 M0020 1 yes yes 49.3908 1 0 1 0 0 0&lt;BR /&gt;12 M0022 4 yes no 85.2923 76 2 76 0 2 1&lt;BR /&gt;13 M0025 1 yes no 78.8611 10 0 10 0 0 2&lt;BR /&gt;14 M0028 8 yes yes 74.3053 13 0 13 0 0 0&lt;BR /&gt;15 M0035 2 yes yes 74.6831 33 0 33 0 0 1&lt;BR /&gt;16 M0036 1 yes yes 54.5243 72 12 72 1 11 6&lt;BR /&gt;17 M0041 1 yes yes 87.5044 3 0 3 0 0 0&lt;BR /&gt;18 M0044 6 yes yes 71.0609 18 0 18 0 0 1&lt;BR /&gt;19 M0047 14 yes yes 81.0924 49 20 49 0 20 1&lt;BR /&gt;20 M0056 5 yes yes 80.7064 61 0 61 0 0 40&lt;BR /&gt;21 M0058 1 yes yes 47.4470 29 0 29 0 0 0&lt;BR /&gt;22 M0060 1 yes no 84.7474 101 0 101 0 0 0&lt;BR /&gt;23 M0062 1 yes no 51.1239 29 0 29 0 0 0&lt;BR /&gt;24 M0065 8 yes yes 76.4873 1 0 1 0 0 0&lt;BR /&gt;25 M0070 3 yes yes 60.9035 62 0 62 0 0 1&lt;BR /&gt;26 M0074 10 yes no 59.3018 61 8 61 0 8 26&lt;BR /&gt;27 M0079 1 yes no 78.0616 17 0 17 0 0 0&lt;BR /&gt;28 M0080 1 yes yes 80.8816 2 0 2 0 0 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So say I want to create a new variable from "sanyapcnsrx" and "santipsychrx" using 1='any fracture' and 0='non fracture' such that I can run proc means. What do I do?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For obs=1 your sanyapcnsrx variable is 33 and santipsychrx is 15. HOW do we know from the values of the two variables whether this is a "any fracture" or "non fracture"? We need to know the rules for identifying the condition our are requesting/&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variables-from-old-ones/m-p/501652#M133790</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-04T18:50:28Z</dc:date>
    </item>
  </channel>
</rss>

