<?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 I find out Non missing from both Character and Numeric Data Type? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797176#M255883</link>
    <description>&lt;P&gt;I don't think that code does what you think you want it to.&lt;/P&gt;
&lt;P&gt;Given the description of your variable BSASDT as character length one and Created_dt as some SAS date value I created similar values and did the assignment "Bsasdt = Created_dt" and this what my log shows:&lt;/P&gt;
&lt;PRE&gt;1    data example;
2       /* first three lines create variables with description
3        similar to your data set*/
4       length bsasdt $ 1;
5       created_dt= today();
6       format created_dt date11.;
7       bsasdt=created_dt;
8    run;

NOTE: Numeric values have been converted to character values at the places given by:
      (Line):(Column).
      7:11
NOTE: Invalid character data, created_dt=22694.00 , at line 7 column 11.
bsasdt=* created_dt=18-FEB-2022 _ERROR_=1 _N_=1
&lt;/PRE&gt;
&lt;P&gt;So unless you really want BSASDT to have * as the result you need to do a lot more work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect what every you did to read or create this particular data set named Test, if not others, did not result in what you intended. I would guess that the data set either resulted directly from Proc Import where the column used for BSASDT was blank in the first few rows of data or was created from a set created in that manner. A character length of 1 is what Import will assign for blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I strongly suspect if you read the data correctly using a data step then you completely bypass the issue of some of these character and numeric. If you have multiple data sets that are supposed to have the same structure, which is sort of implied&amp;nbsp; about using similar code for all of them, have you verified that they have in fact been created with 1) the same variables and 2) that the variables are of the same types and lengths?&lt;/P&gt;</description>
    <pubDate>Fri, 18 Feb 2022 16:11:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-02-18T16:11:18Z</dc:date>
    <item>
      <title>how to I find out Non missing from both Character and Numeric Data Type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797158#M255877</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to find out&amp;nbsp;Non missing from both Character and Numeric Data Type and then overwrite date as shown below from SAS 9.4 EG. I wanted to know is there any simple code to achieve quickly as I have this kind of requirement for multiple datasets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set test;
    if missing(bsasdt) and (not missing(bsdostr) or not missing(bsdorea_1) or not missing(bsdorea_2) 
or not missing(bsdorea_3) or not missing(bsdorea_4) or not missing(status)) then bsasdt = created_dt;
	else bsasdt = bsasdt;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV id="tinyMceEditor1239_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;SAS Attributes of Test dataset shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1239_4-1645167465068.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68636i629D42CDD046509C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1239_4-1645167465068.png" alt="1239_4-1645167465068.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 07:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797158#M255877</guid>
      <dc:creator>1239</dc:creator>
      <dc:date>2022-02-18T07:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to I find out Non missing from both Character and Numeric Data Type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797161#M255879</link>
      <description>&lt;P&gt;The &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/p1tth4ltf640din1ey86ubo2lky2.htm" target="_self"&gt;Cmiss Function&lt;/A&gt; counts missing values of both numeric and character type variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So something like below. (Untested since no test data)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set test;
    if missing(bsasdt) and cmiss(bsdostr, bsdorea_1 - bsdorea_4, status) &amp;lt; 6 then bsasdt = created_dt;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2022 07:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797161#M255879</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-18T07:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to I find out Non missing from both Character and Numeric Data Type?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797176#M255883</link>
      <description>&lt;P&gt;I don't think that code does what you think you want it to.&lt;/P&gt;
&lt;P&gt;Given the description of your variable BSASDT as character length one and Created_dt as some SAS date value I created similar values and did the assignment "Bsasdt = Created_dt" and this what my log shows:&lt;/P&gt;
&lt;PRE&gt;1    data example;
2       /* first three lines create variables with description
3        similar to your data set*/
4       length bsasdt $ 1;
5       created_dt= today();
6       format created_dt date11.;
7       bsasdt=created_dt;
8    run;

NOTE: Numeric values have been converted to character values at the places given by:
      (Line):(Column).
      7:11
NOTE: Invalid character data, created_dt=22694.00 , at line 7 column 11.
bsasdt=* created_dt=18-FEB-2022 _ERROR_=1 _N_=1
&lt;/PRE&gt;
&lt;P&gt;So unless you really want BSASDT to have * as the result you need to do a lot more work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect what every you did to read or create this particular data set named Test, if not others, did not result in what you intended. I would guess that the data set either resulted directly from Proc Import where the column used for BSASDT was blank in the first few rows of data or was created from a set created in that manner. A character length of 1 is what Import will assign for blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I strongly suspect if you read the data correctly using a data step then you completely bypass the issue of some of these character and numeric. If you have multiple data sets that are supposed to have the same structure, which is sort of implied&amp;nbsp; about using similar code for all of them, have you verified that they have in fact been created with 1) the same variables and 2) that the variables are of the same types and lengths?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 16:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-I-find-out-Non-missing-from-both-Character-and-Numeric/m-p/797176#M255883</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-18T16:11:18Z</dc:date>
    </item>
  </channel>
</rss>

