<?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: Check fields with missing values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934337#M367409</link>
    <description>&lt;P&gt;Doing it this way allows you to check 100 fields and store the results in the SAS data set.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 19:47:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-07-01T19:47:34Z</dc:date>
    <item>
      <title>Check fields with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934325#M367406</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I wanted to check if fields are populated based on the criteria. If a field is not populated, then add error_message to indicate the related criterium. For example, in the data I have below, first_name is a field required according to the file "have_ck". When first_name is not populated, the related error_message will need to be added to the original file, as the dummy data "want" shows. Any insight is greatly appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;infile datalines truncover dsd;&lt;BR /&gt;input dummyid first_name $ middle_name $ last_name $ DOB :mmddyy10.;&lt;BR /&gt;format DOB mmddyy10.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 ,Joe , ,Messi ,1/2/1960&lt;BR /&gt;2 , ,S ,Bieber ,4/3/1958&lt;BR /&gt;3 ,Jenny , , ,5/5/1955&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data have_ck;&lt;BR /&gt;infile datalines truncover dsd;&lt;BR /&gt;length field $11. error_message $25.;&lt;BR /&gt;input field $ required error_message $;&lt;BR /&gt;datalines;&lt;BR /&gt;dummyid,1,[dummyid] is required.&lt;BR /&gt;first_name,1,[first_name] is required.&lt;BR /&gt;middle_name,0,&lt;BR /&gt;last_name,1,[last_name] is required.&lt;BR /&gt;DOB,1,[DOB] is required.&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;infile datalines truncover dsd;&lt;BR /&gt;length error_message $25.;&lt;BR /&gt;input dummyid first_name $ middle_name $ last_name $ DOB :mmddyy10. error_message $;&lt;BR /&gt;format DOB mmddyy10.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 ,Joe , ,Messi ,1/2/1960 ,&lt;BR /&gt;2 , ,S ,Bieber ,4/3/1958 ,[first_name] is required.&lt;BR /&gt;3 ,Jenny , , ,5/5/1955 ,[last_name] is required.&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934325#M367406</guid>
      <dc:creator>lichee</dc:creator>
      <dc:date>2024-07-01T19:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Check fields with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934335#M367407</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if missing(First_name) then newfield1='[first_name] is required.';
    if missing(last_name) then newfield2='[last_name] is required.';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This flags the missing fields. In general, I would leave the SAS data set like this, rather than creating a new long string where these missing flags are appended to the existing text; your ability to work with the data set does not require appending the flags to the existing text, and as a matter of fact creating a longer text string just slows you down in the long run.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934335#M367407</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-01T19:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Check fields with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934336#M367408</link>
      <description>Thanks Paige! The thing is that I have to check for 100+ fields, and error messages for the fields vary, rather than in a standard form. I'm required to use the separate file with error messages in case there are more fields are included to check in future.</description>
      <pubDate>Mon, 01 Jul 2024 19:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934336#M367408</guid>
      <dc:creator>lichee</dc:creator>
      <dc:date>2024-07-01T19:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check fields with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934337#M367409</link>
      <description>&lt;P&gt;Doing it this way allows you to check 100 fields and store the results in the SAS data set.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fields-with-missing-values/m-p/934337#M367409</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-01T19:47:34Z</dc:date>
    </item>
  </channel>
</rss>

