<?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: Arrays to delete missing value, and to recode from character to number in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496100#M6220</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data hw2;
 set datasets.riskdata;
 array a {5} cbypass cbv_ds respprob neuropthy pvd;
 do i=1 to 5;
 if uppercase(a{i})= 'Y' then a{i}=1;
 end;
 run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Sep 2018 01:23:32 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2018-09-17T01:23:32Z</dc:date>
    <item>
      <title>Arrays to delete missing value, and to recode from character to number</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496098#M6219</link>
      <description>&lt;P&gt;Hi, I have a database with character observations ( y and n) I want to assign them values to calculate the comorbidity index. The code I am using is the following with no result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;data hw2;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;set datasets.riskdata;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;array a {5} cbypass cbv_ds respprob neuropthy pvd;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;do i=1 to 5;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;if a{i}= y then a{i}=1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;84:17&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable y is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 830 observations read from the data set DATASETS.RISKDATA.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.HW2 has 830 observations and 14 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Also I am trying to use arrays to erase missing values with this code but is also not working.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;data hw2;&lt;BR /&gt;set datasets.riskdata;&lt;BR /&gt;if diagnosis= 'TYPE1_DM' then diagnosis='2';&lt;BR /&gt;if diagnosis='TYPE2_DM' THEN DIAGNOSIS='0';&lt;BR /&gt;if diagnosis= 'PXECTMY'&amp;nbsp; then diagnosis='0';&lt;BR /&gt;IF los&amp;lt;0 then los=.;&lt;BR /&gt;array a{9} diagnosis dialysis cbypass cbv_ds respprob neuropthy mi pvd lipiddis;&lt;BR /&gt;do i=1 to 9;&lt;BR /&gt;if a{i}= ' ' then a{i}=delete;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 01:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496098#M6219</guid>
      <dc:creator>emma19901</dc:creator>
      <dc:date>2018-09-17T01:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays to delete missing value, and to recode from character to number</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496100#M6220</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data hw2;
 set datasets.riskdata;
 array a {5} cbypass cbv_ds respprob neuropthy pvd;
 do i=1 to 5;
 if uppercase(a{i})= 'Y' then a{i}=1;
 end;
 run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 01:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496100#M6220</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-09-17T01:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays to delete missing value, and to recode from character to number</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496102#M6221</link>
      <description>&lt;P&gt;For your first question, you will need to define a new set of variables.&amp;nbsp; Character variables won't hold numeric values.&amp;nbsp; One possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasSource"&gt;data hw2;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;set datasets.riskdata;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;array a {5} cbypass cbv_ds respprob neuropthy pvd;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;array b {5} cbypass_num cbv_ds_num respprob_num neuropthy_num pvd_num;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;do i=1 to 5;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;if upcase(a{i})= "Y" then b{i}=1;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;else b{i}=0;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;end;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;run;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;Notice that when you omit the quotes, y refers to a variable name.&amp;nbsp; When you add quotes, "Y" refers to a character string.&amp;nbsp; This will impact your second question where you check whether a variable is equal to delete.&amp;nbsp; With no quotes, delete is the name of a variable.&amp;nbsp; Clearly, this is not the comparison you want to make.&amp;nbsp; However, your objective in the second DATA step is not clear.&amp;nbsp; What are you trying to accomplish?&amp;nbsp; Describe the results you want, don't show a program.&amp;nbsp; It's really not clear what you want when you say "erase missing values".&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 Sep 2018 02:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Arrays-to-delete-missing-value-and-to-recode-from-character-to/m-p/496102#M6221</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-09-17T02:03:23Z</dc:date>
    </item>
  </channel>
</rss>

