<?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 Problems in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703538#M26045</link>
    <description>&lt;P&gt;Easy part first:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the things that the log is saying that I'm really not sure about is this:&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable AgeAtVisit is uninitialized.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable InDemogs is uninitialized.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable InVitals is uninitialized.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable Indvbl is uninitialized.&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This occurs when you use a variable name that has no values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Likely cause for some spelling:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Merge HypTabs.Demog (IN = &lt;FONT size="5" color="#008000"&gt;&lt;STRONG&gt;InDemog&lt;/STRONG&gt;&lt;/FONT&gt; Drop = EthRaceCd)
Hyptabs.Contact (IN= InContact Keep= SSN StateCd)
Work.LastVitals (IN = &lt;FONT size="5"&gt;&lt;STRONG&gt;InLastVitals&lt;/STRONG&gt;&lt;/FONT&gt; Drop= HtIN)
Hyptabs.NDI (IN= INNDI Drop=Deathdt ICD10 CODCD);

By SSN;
IF Incontact=1 AND
&lt;FONT size="5" color="#008000"&gt;&lt;STRONG&gt;InDemogs&lt;/STRONG&gt;&lt;/FONT&gt; = 1 AND
&lt;FONT size="5"&gt;&lt;STRONG&gt;InVitals&lt;/STRONG&gt;&lt;/FONT&gt; = 1;

If Indvbl = . THEN Hypre1DeathInd = 0;
Else IF Indvbl = 0 THEN HypReIDeathInd= 0;
ELSE IF IndVbl = 1 THEN HypRelDeathInd = 1;&lt;/PRE&gt;
&lt;P&gt;Your Retain and Format AgeAtVisit, you assign a value to AgeAtVisit1. If AgeAtVisit is NOT in one of the data sets, which it isn't because you did not KEEP it, then there is no value and causes the note for that variable. BTW you are getting luck with the YRDIF function. It is default to "AGE" as the basis. AgeAtVisit is &lt;STRONG&gt;not&lt;/STRONG&gt; a valid basis value. Sort of surprised you don't get a warning or error from that use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;STRONG&gt;only &lt;/STRONG&gt;place Indvbl appears is in those If statements. It is not a variable kept from one of the sets and is &lt;STRONG&gt;not&lt;/STRONG&gt; the name of one of the IN= created variables. From the other spellling errors I suspect it was intended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When asking questions about why you don't get an expected number of observations as a minimum you should include the entire log with ALL the notes, warnings and such. That will tell us how many records each of the contributing data sets brings in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a subsetting IF that can never be true because of two variables misspelled. So that would be the main cause for getting 0 observations:&lt;/P&gt;
&lt;PRE&gt;IF Incontact=1 AND
InDemogs = 1 AND
InVitals = 1;&lt;/PRE&gt;
&lt;P&gt;You have a&lt;/P&gt;
&lt;P&gt;Merge BY SSN;&lt;/P&gt;
&lt;P&gt;HyTabs.Contact is the only data set shown with the SSN variable. So does your code throw a number of &lt;STRONG&gt;ERRORS&lt;/STRONG&gt; about missing BY variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now for the fun part.&lt;/P&gt;
&lt;P&gt;Why do you think there should be 573 observations? Is that the number of one of the sets? If so, which one?&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, 04 Dec 2020 20:08:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-12-04T20:08:46Z</dc:date>
    <item>
      <title>Merging Problems</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703532#M26041</link>
      <description>&lt;P&gt;In the program I am working on I am looking to have 573 observations after everything is merged, however I am either coming up with 598 or 0, and the variable Age is also dropping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Proc contents Data= Hyptabs.vitals;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;Data Work.lastvitals;&lt;BR /&gt;Set Hyptabs.vitals;&lt;BR /&gt;By SSN;&lt;BR /&gt;IF Last.SSN= 1;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;Data Hypanl.Hypanalysis2;&lt;BR /&gt;Retain SSN StateCd&lt;BR /&gt;GenderCd EthCd RaceCd AgeAtVisit&lt;BR /&gt;SBP DBP WtLb&lt;BR /&gt;HypRelDeathInd;&lt;/P&gt;&lt;P&gt;Merge HypTabs.Demog (IN = InDemog Drop = EthRaceCd)&lt;BR /&gt;Hyptabs.Contact (IN= InContact Keep= SSN StateCd)&lt;BR /&gt;Work.LastVitals (IN = InLastVitals Drop= HtIN)&lt;BR /&gt;Hyptabs.NDI (IN= INNDI Drop=Deathdt ICD10 CODCD);&lt;/P&gt;&lt;P&gt;By SSN;&lt;BR /&gt;IF Incontact=1 AND&lt;BR /&gt;InDemogs = 1 AND&lt;BR /&gt;InVitals = 1;&lt;/P&gt;&lt;P&gt;If Indvbl = . THEN Hypre1DeathInd = 0;&lt;BR /&gt;Else IF Indvbl = 0 THEN HypReIDeathInd= 0;&lt;BR /&gt;ELSE IF IndVbl = 1 THEN HypRelDeathInd = 1;&lt;/P&gt;&lt;P&gt;AgeAtVisit1 = YRDIF(BirthDt, VisitDt, 'AGEAtvisit');&lt;BR /&gt;FORMAT AgeAtVisit 2.0;&lt;/P&gt;&lt;P&gt;DROP BirthDt VisitDt;&lt;BR /&gt;Run;&lt;BR /&gt;Proc Print Data=Hypanl.hypanalysis2;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of the things that the log is saying that I'm really not sure about is the log saying this:&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable AgeAtVisit is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable InDemogs is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable InVitals is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable Indvbl is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;What does that mean, and is that where my problem lies?&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703532#M26041</guid>
      <dc:creator>bhufman</dc:creator>
      <dc:date>2020-12-10T15:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Problems</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703538#M26045</link>
      <description>&lt;P&gt;Easy part first:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the things that the log is saying that I'm really not sure about is this:&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable AgeAtVisit is uninitialized.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable InDemogs is uninitialized.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable InVitals is uninitialized.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;NOTE: Variable Indvbl is uninitialized.&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This occurs when you use a variable name that has no values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Likely cause for some spelling:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Merge HypTabs.Demog (IN = &lt;FONT size="5" color="#008000"&gt;&lt;STRONG&gt;InDemog&lt;/STRONG&gt;&lt;/FONT&gt; Drop = EthRaceCd)
Hyptabs.Contact (IN= InContact Keep= SSN StateCd)
Work.LastVitals (IN = &lt;FONT size="5"&gt;&lt;STRONG&gt;InLastVitals&lt;/STRONG&gt;&lt;/FONT&gt; Drop= HtIN)
Hyptabs.NDI (IN= INNDI Drop=Deathdt ICD10 CODCD);

By SSN;
IF Incontact=1 AND
&lt;FONT size="5" color="#008000"&gt;&lt;STRONG&gt;InDemogs&lt;/STRONG&gt;&lt;/FONT&gt; = 1 AND
&lt;FONT size="5"&gt;&lt;STRONG&gt;InVitals&lt;/STRONG&gt;&lt;/FONT&gt; = 1;

If Indvbl = . THEN Hypre1DeathInd = 0;
Else IF Indvbl = 0 THEN HypReIDeathInd= 0;
ELSE IF IndVbl = 1 THEN HypRelDeathInd = 1;&lt;/PRE&gt;
&lt;P&gt;Your Retain and Format AgeAtVisit, you assign a value to AgeAtVisit1. If AgeAtVisit is NOT in one of the data sets, which it isn't because you did not KEEP it, then there is no value and causes the note for that variable. BTW you are getting luck with the YRDIF function. It is default to "AGE" as the basis. AgeAtVisit is &lt;STRONG&gt;not&lt;/STRONG&gt; a valid basis value. Sort of surprised you don't get a warning or error from that use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The &lt;STRONG&gt;only &lt;/STRONG&gt;place Indvbl appears is in those If statements. It is not a variable kept from one of the sets and is &lt;STRONG&gt;not&lt;/STRONG&gt; the name of one of the IN= created variables. From the other spellling errors I suspect it was intended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When asking questions about why you don't get an expected number of observations as a minimum you should include the entire log with ALL the notes, warnings and such. That will tell us how many records each of the contributing data sets brings in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a subsetting IF that can never be true because of two variables misspelled. So that would be the main cause for getting 0 observations:&lt;/P&gt;
&lt;PRE&gt;IF Incontact=1 AND
InDemogs = 1 AND
InVitals = 1;&lt;/PRE&gt;
&lt;P&gt;You have a&lt;/P&gt;
&lt;P&gt;Merge BY SSN;&lt;/P&gt;
&lt;P&gt;HyTabs.Contact is the only data set shown with the SSN variable. So does your code throw a number of &lt;STRONG&gt;ERRORS&lt;/STRONG&gt; about missing BY variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now for the fun part.&lt;/P&gt;
&lt;P&gt;Why do you think there should be 573 observations? Is that the number of one of the sets? If so, which one?&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, 04 Dec 2020 20:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703538#M26045</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-04T20:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Problems</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703688#M26055</link>
      <description>&lt;P&gt;My understanding is that the Drop and keep statements could be throwing off the code. the items you are dropping and keeping will do what you want by merging them, there will not be an "excess" of information that you need to make sure is kept or dropped.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA	Analysis;&lt;BR /&gt;	MERGE	Vitals (In = INVitals)&lt;BR /&gt;			Demog (In = INDemog)&lt;BR /&gt;			Contact (In = INContact)&lt;BR /&gt;			NDI (In = InDeathDt);&lt;BR /&gt;		BY	SSN; &lt;BR /&gt;If last.SSN ;	&lt;BR /&gt;If InVitals = 1 AND&lt;BR /&gt;	InDemog = 1 And&lt;BR /&gt;	InContact = 1;&lt;BR /&gt;If HypRelDeathInd = '.' Then HypRelDeathInd = 0;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703688#M26055</guid>
      <dc:creator>Cooksam13</dc:creator>
      <dc:date>2020-12-10T15:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Problems</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703737#M26058</link>
      <description>&lt;P&gt;Looks like others have helped you with most of the errors, but the reason you are getting the Indvbl error is because that is a format, not a variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code you want looks like this:&lt;/P&gt;&lt;P&gt;IF HypRelDeathInd = '.' THEN HypRelDeathInd = 0;&lt;/P&gt;&lt;P&gt;FORMAT HypRelDeathInd IndVbl.;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 22:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703737#M26058</guid>
      <dc:creator>haileyhw</dc:creator>
      <dc:date>2020-12-04T22:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Problems</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703915#M26066</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was running into a similar issue. I think here is where it lies.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;InVitals = 1;&lt;/P&gt;&lt;P&gt;If Indvbl = . THEN Hypre1DeathInd = 0;&lt;BR /&gt;Else IF Indvbl = 0 THEN HypReIDeathInd= 0;&lt;BR /&gt;ELSE IF IndVbl = 1 THEN HypRelDeathInd = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since your code is referring to lastvitals, the InVitals = 1, needs to be changed to InLastVitals = 1. Then the IndVbl is a format not a variable. Should be like this:&amp;nbsp;FORMAT HypRelDeathInd IndVbl.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Dec 2020 07:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Merging-Problems/m-p/703915#M26066</guid>
      <dc:creator>mdakkak</dc:creator>
      <dc:date>2020-12-06T07:13:02Z</dc:date>
    </item>
  </channel>
</rss>

