<?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 simple use of 'if' and 'missing' in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171318#M32893</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone&lt;/P&gt;&lt;P&gt;I have a very simple issue that I don't understand what the problem is. I have a data step that uses two 'if' statements and 'missing' to detect if another variable is present or not and populate another variable with a 'y' or 'n' flag based on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run this, the 'conferenced' variable always comes out 'n' when this is clearly not the case: there are many instances of 'ConfDate' having a date populated. Is there something really simple I am missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tendayconf4 &lt;/P&gt;&lt;P&gt;(rename=(cnty_name=County docno1=Docket start=PlaceStart stop=PlaceStop durat=TimeInCare&lt;/P&gt;&lt;P&gt;filing1=FilingDate adjud1=AdjudDate dur_adjud1=FilingToAdjud&lt;/P&gt;&lt;P&gt;dispo1=DispoDate dur_dispo1=FilingToDispo issuejoindate=IJDate &lt;/P&gt;&lt;P&gt;appearance_date=ConfDate IjDateConfDate=IJDateToConfDate Col3=Part));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length cnty_name $ 50 docno1 $ 20 CohortYear 4 start 8 stop 8 Status $ 50&lt;/P&gt;&lt;P&gt;durat 8 filing1 8 adjud1 8 dur_adjud1 8 dispo1 8 &lt;/P&gt;&lt;P&gt;dur_dispo1 8 issuejoindate 8 appearance_date 8&lt;/P&gt;&lt;P&gt;IjDateConfDate 8 Col3 $ 50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set tendayconf3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if missing(ConfDate) then Conferenced="N";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not missing(ConfDate) then Conferenced="Y";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Oct 2014 12:55:03 GMT</pubDate>
    <dc:creator>Paul_NYS</dc:creator>
    <dc:date>2014-10-03T12:55:03Z</dc:date>
    <item>
      <title>simple use of 'if' and 'missing' in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171318#M32893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone&lt;/P&gt;&lt;P&gt;I have a very simple issue that I don't understand what the problem is. I have a data step that uses two 'if' statements and 'missing' to detect if another variable is present or not and populate another variable with a 'y' or 'n' flag based on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run this, the 'conferenced' variable always comes out 'n' when this is clearly not the case: there are many instances of 'ConfDate' having a date populated. Is there something really simple I am missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tendayconf4 &lt;/P&gt;&lt;P&gt;(rename=(cnty_name=County docno1=Docket start=PlaceStart stop=PlaceStop durat=TimeInCare&lt;/P&gt;&lt;P&gt;filing1=FilingDate adjud1=AdjudDate dur_adjud1=FilingToAdjud&lt;/P&gt;&lt;P&gt;dispo1=DispoDate dur_dispo1=FilingToDispo issuejoindate=IJDate &lt;/P&gt;&lt;P&gt;appearance_date=ConfDate IjDateConfDate=IJDateToConfDate Col3=Part));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length cnty_name $ 50 docno1 $ 20 CohortYear 4 start 8 stop 8 Status $ 50&lt;/P&gt;&lt;P&gt;durat 8 filing1 8 adjud1 8 dur_adjud1 8 dispo1 8 &lt;/P&gt;&lt;P&gt;dur_dispo1 8 issuejoindate 8 appearance_date 8&lt;/P&gt;&lt;P&gt;IjDateConfDate 8 Col3 $ 50;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set tendayconf3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if missing(ConfDate) then Conferenced="N";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not missing(ConfDate) then Conferenced="Y";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 12:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171318#M32893</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2014-10-03T12:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: simple use of 'if' and 'missing' in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171319#M32894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You "generate" the ConfDate variable when writing to the output dataset tendayconf4 (through renaming appearance_date).&lt;/P&gt;&lt;P&gt;"Inside" the data step it is still appearance date. The way you wrote that statement, ConfDate is always empty (because it most probably is not present in the input dataset).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171319#M32894</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-10-03T13:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: simple use of 'if' and 'missing' in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171320#M32895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are renaming variables in the wrong place&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tendayconf4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length cnty_name $ 50 docno1 $ 20 CohortYear 4 start 8 stop 8 Status $ 50 durat 8 filing1 8 adjud1 8 dur_adjud1 8 dispo1 8 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dur_dispo1 8 issuejoindate 8 appearance_date 8 IjDateConfDate 8 Col3 $ 50;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set tendayconf3(rename=(cnty_name=County docno1=Docket start=PlaceStart stop=PlaceStop durat=TimeInCare&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filing1=FilingDate adjud1=AdjudDate dur_adjud1=FilingToAdjud&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dispo1=DispoDate dur_dispo1=FilingToDispo issuejoindate=IJDate &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; appearance_date=ConfDate IjDateConfDate=IJDateToConfDate Col3=Part));&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if missing(ConfDate) then Conferenced="N";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not missing(ConfDate) then Conferenced="Y";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171320#M32895</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2014-10-03T13:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: simple use of 'if' and 'missing' in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171321#M32896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Kurt!! I am so stupid. Thanks again!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171321#M32896</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2014-10-03T13:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: simple use of 'if' and 'missing' in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171322#M32897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the bother, but just thought of adding an extra point in the understanding. Looking at Paigemiller and Kurt's response, I wanted to mention what happens in the PDV when SAS reads variables from an input dataset and when SAS writes variables to the output dataset. When you use any dataset option such as (rename= drop=) in the set statement, SAS executes or in your case renames these variables before the variables are brought into the PDV whereas when you use the same in the data statement, SAS just writes the renamed variables to the output dataset at the end of the exceution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, using dataset option is very powerful as opposed to rename/drop statement in the datastep, it helps you filter and alter your needs at an early stage before the variables are read in the memory area PDV, thus saving a lot of execution time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that helps,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Oct 2014 13:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simple-use-of-if-and-missing-in-data-step/m-p/171322#M32897</guid>
      <dc:creator>INGODWETRUST</dc:creator>
      <dc:date>2014-10-03T13:53:04Z</dc:date>
    </item>
  </channel>
</rss>

