<?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: My data has ######## as a missing character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894738#M353440</link>
    <description>&lt;P&gt;Importing a csv file with non-standard missing values (standard = empty field) with proc import will lead to extra work and may lead to variables with a wrong guessed type. So better write a data step yourself to avoid all the things you have to do get the data step with proper typed variables (and lengths).&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2023 05:54:01 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2023-09-18T05:54:01Z</dc:date>
    <item>
      <title>My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894705#M353423</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data is from a big csv file and in that file, the authors used ####### as a missing value. How do I get sas to identify this as a missing value and not try to fill it in?&lt;/P&gt;&lt;P&gt;My code right now is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import out=work.problems&lt;BR /&gt;datafile="/home/u63556826/sasuser.v94/problems.csv"&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;getnames=YES;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=work.problems (obs = 6); run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 20:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894705#M353423</guid>
      <dc:creator>EricB40</dc:creator>
      <dc:date>2023-09-17T20:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894706#M353424</link>
      <description>&lt;P&gt;While there are ways to do this when you read in the data, it will probably be easier to convert it after you have read the data into a SAS dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data problems2;
  set problems ;
  array chars{*} _character_ ;
  do i=1 to dim(chars);
    if chars{i}='########' then call missing(chars{i});
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if you want numeric variables, you could add code to create numeric variables from the character variables, using the INPUT function.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 21:02:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894706#M353424</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-09-17T21:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894710#M353426</link>
      <description>&lt;P&gt;Would that look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import out=work.problems&lt;BR /&gt;datafile="/home/u63556826/sasuser.v94/problems.csv"&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;getnames=YES;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data problems2;&lt;BR /&gt;set problems ;&lt;BR /&gt;array chars{*} _character_ ;&lt;BR /&gt;do i=1 to dim(chars);&lt;BR /&gt;if chars{i}='########' then call missing(chars{i});&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=work.problems (obs = 6); run;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 21:30:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894710#M353426</guid>
      <dc:creator>EricB40</dc:creator>
      <dc:date>2023-09-17T21:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894717#M353428</link>
      <description>&lt;P&gt;Yes, that was my thought.&amp;nbsp; How does it work for your need?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Sep 2023 22:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894717#M353428</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-09-17T22:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894718#M353429</link>
      <description>&lt;P&gt;If the data are in a text or csv or other ascii file, you can use INFORMATs to tell SAS to convert '########' to missing values, both for numeric, and for character variables:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  invalue shnum '########'=.
           other=[best32.];
  invalue $shchr '########'=' '  min=8 max=20
           other=[$20.];
run;

data test;
  informat default=shnum. ;
  input id $5.  num1  num2  char1 :$shchr10. char2 :$shchr. ;
datalines;
AAAAA ######## 1002     ch11_6789A ch12_6789ABC
BBBBB 2001     2002     ########   ch22_6789ABC
CCCCC 3001     ######## ch31_6789A ########
DDDDD ######## ######## ########   ########
run;
proc print;
  var id num1 num2 char1 char2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 00:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894718#M353429</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-09-18T00:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894738#M353440</link>
      <description>&lt;P&gt;Importing a csv file with non-standard missing values (standard = empty field) with proc import will lead to extra work and may lead to variables with a wrong guessed type. So better write a data step yourself to avoid all the things you have to do get the data step with proper typed variables (and lengths).&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 05:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894738#M353440</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-09-18T05:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: My data has ######## as a missing character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894808#M353470</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Importing a csv file with non-standard missing values (standard = empty field) with proc import will lead to extra work and may lead to variables with a wrong guessed type. So better write a data step yourself to avoid all the things you have to do get the data step with proper typed variables (and lengths).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Definitely agree. I have data sources where they can't even be consistent and one file will have: NA, not answered, UNK , unknown, refused to answer in ONE variable just for what should be missing values. Proc format can handle multiple strings like that to all set one standard "missing" value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 15:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/My-data-has-as-a-missing-character/m-p/894808#M353470</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-18T15:37:12Z</dc:date>
    </item>
  </channel>
</rss>

