<?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: creating a new variable from available variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583429#M166089</link>
    <description>&lt;P&gt;Please post the result you expect from the data you have posted.&lt;/P&gt;
&lt;P&gt;The function cmiss returns the number of variables with missing value. If the number of variables is always 7, something like&lt;/P&gt;
&lt;PRE&gt;count_spe = 7 - cmiss(of spe1-spe7);&lt;/PRE&gt;
&lt;P&gt;should give you the number you want.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2019 10:48:45 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-08-23T10:48:45Z</dc:date>
    <item>
      <title>creating a new variable from available variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583427#M166087</link>
      <description>&lt;P&gt;I have a data set that has&lt;/P&gt;&lt;P&gt;ID spe1 test1 result1&amp;nbsp;&amp;nbsp;spe2 test2 result2 spe3 test3 result3 spe4 test4 result4 spe5 test5 result5 spe6 test6 result6 spe7 test7 result7&lt;/P&gt;&lt;P&gt;1&amp;nbsp; ur&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;thr&amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; &amp;nbsp;pos&amp;nbsp; &amp;nbsp; &amp;nbsp; rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&lt;/P&gt;&lt;P&gt;2&amp;nbsp;ur&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&lt;/P&gt;&lt;P&gt;3 thr&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; pos&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;4 ur&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;thr&amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; &amp;nbsp;pos&amp;nbsp;&lt;/P&gt;&lt;P&gt;5 rec&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; pos&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;thr&amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; &amp;nbsp;pos&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;6 rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ur&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;thr&amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; &amp;nbsp;pos&amp;nbsp; &amp;nbsp; &amp;nbsp; rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&amp;nbsp;&lt;/P&gt;&lt;P&gt;7 rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; pos&amp;nbsp; &amp;nbsp; &amp;nbsp; ur&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;thr&amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; &amp;nbsp;pos&amp;nbsp; &amp;nbsp; &amp;nbsp; cvx&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&lt;/P&gt;&lt;P&gt;7 rec&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; pos&amp;nbsp; &amp;nbsp; &amp;nbsp; ur&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;thr&amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; &amp;nbsp;pos&amp;nbsp; &amp;nbsp; &amp;nbsp; cvx&amp;nbsp; &amp;nbsp; Nat&amp;nbsp; &amp;nbsp; neg&amp;nbsp;&amp;nbsp; urt&amp;nbsp; &amp;nbsp; &amp;nbsp; cul&amp;nbsp; &amp;nbsp; neg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know number of tests conducted for each ID and number of Spe collected and number of pos result for each ID. How do i create a separate column of number of spe number of tests and number of pos result by speciemn&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 10:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583427#M166087</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2019-08-23T10:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new variable from available variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583429#M166089</link>
      <description>&lt;P&gt;Please post the result you expect from the data you have posted.&lt;/P&gt;
&lt;P&gt;The function cmiss returns the number of variables with missing value. If the number of variables is always 7, something like&lt;/P&gt;
&lt;PRE&gt;count_spe = 7 - cmiss(of spe1-spe7);&lt;/PRE&gt;
&lt;P&gt;should give you the number you want.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 10:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583429#M166089</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-23T10:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new variable from available variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583435#M166092</link>
      <description>Thank you! thank you!&lt;BR /&gt;I got the column of what I want that are count of Specimen count of tests and count of result.&lt;BR /&gt;Now i would like to get results by specimen. for example a patient had 3 different tests of those three tests how many results are positive and positive from what specimen. Please help</description>
      <pubDate>Fri, 23 Aug 2019 11:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583435#M166092</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2019-08-23T11:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: creating a new variable from available variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583436#M166093</link>
      <description>&lt;P&gt;If you are creating this data set, and you have a choice, I would create it vertically rather than horizontally. This makes most analyses much simpler, and probably can be done using PROC FREQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID     SEQUENCE             SPE         TEST          RESULT
1       1                   ur          cul           neg
1       2                   thr         cul           pos&lt;/PRE&gt;
&lt;P&gt;Even better yet, result could be 0 (negative) or 1 (positive) instead of neg or pos.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are receiving the data in the wide format you showed, I would make the effort to transpose it to the long format to make things easier.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 11:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-new-variable-from-available-variables/m-p/583436#M166093</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-23T11:29:26Z</dc:date>
    </item>
  </channel>
</rss>

