<?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 Assigning dummy family ids to patients with no family ids in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542795#M150005</link>
    <description>&lt;P&gt;I&amp;nbsp;have a dataset with 4500 observations&amp;nbsp; with variables family_ids, patient_id, Diabetes (1/0), age, sex, BMI&lt;/P&gt;&lt;P&gt;Some of the patients do not belong to any family and have not been assigned any family id. for e.g, the data is like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Family_ids patient&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are 191 patients&amp;nbsp; with no family id. I would like to assign a family id to these patients other than the family ids already in the dataset. I would like to do so because the class identifier in my multilevel model is family_id. I would not like to delete these observations or assign a missing value to them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can it be done? Any help is appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2019 14:13:52 GMT</pubDate>
    <dc:creator>AVA_16</dc:creator>
    <dc:date>2019-03-13T14:13:52Z</dc:date>
    <item>
      <title>Assigning dummy family ids to patients with no family ids</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542795#M150005</link>
      <description>&lt;P&gt;I&amp;nbsp;have a dataset with 4500 observations&amp;nbsp; with variables family_ids, patient_id, Diabetes (1/0), age, sex, BMI&lt;/P&gt;&lt;P&gt;Some of the patients do not belong to any family and have not been assigned any family id. for e.g, the data is like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Family_ids patient&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are 191 patients&amp;nbsp; with no family id. I would like to assign a family id to these patients other than the family ids already in the dataset. I would like to do so because the class identifier in my multilevel model is family_id. I would not like to delete these observations or assign a missing value to them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can it be done? Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542795#M150005</guid>
      <dc:creator>AVA_16</dc:creator>
      <dc:date>2019-03-13T14:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning dummy family ids to patients with no family ids</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542800#M150007</link>
      <description>&lt;P&gt;Yes, but not enough information is provided.&amp;nbsp; Is family sequential, i.e. do you want any new ones added to the end, or fill gaps, or be completely distinct?&amp;nbsp; For instance, you could simply take max(family) then a datastep which assigns missing from max(family)+1 onwards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, post test data in the form of a datastep, this is an essential practice in order to get good responses.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 14:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542800#M150007</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-03-13T14:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning dummy family ids to patients with no family ids</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542908#M150060</link>
      <description>&lt;P&gt;Here is one way assuming that you have no more than 1000 actual Family Id "numbers" assigned.&lt;/P&gt;
&lt;P&gt;Note that I treat Family_id and Patient as character variables as I would not expect to be doing arithmetic with them. If your values are actually numeric then the assignment for Family_id when missing would not involve the "put", just the Famnum variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
   input Family_id $ patient $;
datalines;
.  1 
.  3 
.  4 
.  6 
.  9 
1 20 
1 21 
1 90 
. 6
;
run;


proc sort data=have;
  by patient;
run;

data want;
   set have;
   by patient;
   retain famnum 1000;
   if first.patient and missing(Family_id) then famnum+1;
   if missing(Family_id) then Family_id = put(famnum,best5. -L);
   drop famnum;
run;&lt;/PRE&gt;
&lt;P&gt;An example of how to provide a data step of values.&lt;/P&gt;
&lt;P&gt;The sort is to get all of the same patient records together, in case they do appear multiple times. I provided an example patient that appears twice.&lt;/P&gt;
&lt;P&gt;The last data step uses the BY patient to increment the "family_id" when a patient is missing one and assign the new value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you just happened to have an insurance policy number lying around that might be useable to group missing family id if they have the same policy information. Not a guarantee but one way to get somewhat better family membership for some.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 18:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/542908#M150060</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-13T18:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning dummy family ids to patients with no family ids</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/543075#M150119</link>
      <description>Thank you. Worked.</description>
      <pubDate>Thu, 14 Mar 2019 10:12:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-dummy-family-ids-to-patients-with-no-family-ids/m-p/543075#M150119</guid>
      <dc:creator>AVA_16</dc:creator>
      <dc:date>2019-03-14T10:12:09Z</dc:date>
    </item>
  </channel>
</rss>

