<?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: Merging and creating a New Variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608683#M17733</link>
    <description>&lt;P&gt;As Reeza pointed out, Add a condition to fix it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; if not missing (BirthDt)  and not missing(VisitDt) then AgeAtVisit &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;YRDIF&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;BirthDt&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; VisitDt&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'AGE'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 Dec 2019 11:54:11 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-12-02T11:54:11Z</dc:date>
    <item>
      <title>Merging and creating a New Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608602#M17707</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Hypanl.Hypanalysis2;
	merge WORK.RecentVisit (IN = InRecentVisit)
		  HypTabs.contact (IN= Incontact)
		  HypTabs.demog (IN = Indemog)
		  HypTabs.ndi ( IN= Inndi);
	BY SSN;
	IF InRecentVisit = 1 AND Incontact = 1 AND Indemog = 1 AND Inndi = 1;
    AgeAtVisit = YRDIF(BirthDt, VisitDt, 'AGE');
	FORMAT AgeAtVisit 4.1;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am currently working to merge the first three data sets and exclude those that are in the ndi data set. My problem is when I try to create the AgeAtVisit variable. I keep getting the note below and a missing value for the AgeAtVisit variable. (This is not real data. It was created for the purposes of teaching concepts and skills).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE: Invalid argument to function YRDIF(.,19450,'AGE') at line 80 column 15.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;InRecentVisit=1 Incontact=1 Indemog=1 Inndi=1 SSN=XXX-XX-XXXX VisitDt=02APR2013 HtIn=67 WtLb=159 SBP=159 DBP=65 Inits=TRB City=Provo&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;StateCd=Utah ZipCd=84604 GenderCd=Male EthCd=Non-Hispanic RaceCd=White EthRaceCd=NH White BirthDt=. DeathDt=2015-05-26 ICD10=I25.21&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;CODCd=Heart Disease HypRelDeathInd=Yes FIRST.SSN=1 LAST.SSN=1 AgeAtVisit=. _ERROR_=1 _N_=629&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Dec 2019 00:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608602#M17707</guid>
      <dc:creator>walkerel</dc:creator>
      <dc:date>2019-12-03T00:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Merging and creating a New Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608604#M17708</link>
      <description>&lt;P&gt;Look at the log and if this is real data let me know please be more careful with your posts, you've included enough to identify a person, including SSN, location (Utah), gender and zip code. I've masked the SSN and removed it from your original post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the record here, birth date is missing so you cannot calculate an age.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasNote"&gt;NOTE: Invalid argument to function YRDIF(&lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/FONT&gt;,19450,'AGE') at line 80 column 15.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;InRecentVisit=1 Incontact=1 Indemog=1 Inndi=1 &lt;STRONG&gt;SSN=XXXXXXX&lt;/STRONG&gt; VisitDt=02APR2013 HtIn=67 WtLb=159 SBP=159 DBP=65 Inits=TRB City=Provo&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;StateCd=Utah ZipCd=84604 GenderCd=Male EthCd=Non-Hispanic RaceCd=White EthRaceCd=NH White &lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;BirthDt=.&lt;/STRONG&gt; &lt;/FONT&gt;DeathDt=2015-05-26 ICD10=I25.21&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;CODCd=Heart Disease HypRelDeathInd=Yes FIRST.SSN=1 LAST.SSN=1 AgeAtVisit=. _ERROR_=1 _N_=629&lt;/DIV&gt;</description>
      <pubDate>Sun, 01 Dec 2019 22:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608604#M17708</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-12-01T22:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Merging and creating a New Variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608683#M17733</link>
      <description>&lt;P&gt;As Reeza pointed out, Add a condition to fix it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; if not missing (BirthDt)  and not missing(VisitDt) then AgeAtVisit &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;YRDIF&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;BirthDt&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; VisitDt&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'AGE'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Dec 2019 11:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-and-creating-a-New-Variable/m-p/608683#M17733</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-02T11:54:11Z</dc:date>
    </item>
  </channel>
</rss>

