<?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: How do I create empty records from census data to working dataset? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842793#M333255</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432452"&gt;@SP01&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;It appears you are trying to join two datasets using common variable.&lt;BR /&gt;Consider using data step merge using&amp;nbsp; common by variables.&lt;BR /&gt;Alternatively consider using Proc SQL join.&lt;/P&gt;</description>
    <pubDate>Sun, 06 Nov 2022 22:06:28 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2022-11-06T22:06:28Z</dc:date>
    <item>
      <title>How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842744#M333226</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I have a task to create a working population dataset. My working dataset A has row level information by age, race, sex, and county. I need to count records by these variables and then add required records from dataset B to have full population. Please offer any guidance or suggestion on how to do this. Thank you!&lt;/P&gt;&lt;P&gt;I am attaching the example in the spreadsheet here.&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Sources&lt;/TD&gt;&lt;TD&gt;Total number&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Category&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Census&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;Gender: Female; Age: 20; Race: W; County: Lancaster&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Working dataset&lt;/TD&gt;&lt;TD&gt;67&lt;/TD&gt;&lt;TD&gt;Gender: Female; Age: 20; Race: W; County: Lancaster&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Empty records need&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;Gender: Female; Age: 20; Race: W; County: Lancaster&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Census&lt;/TD&gt;&lt;TD&gt;95&lt;/TD&gt;&lt;TD&gt;Gender: Male; Age: 57; Race: B; County: Adams&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Working dataset&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;Gender: Male; Age: 57; Race: B; County: Adams&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Empty records need&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;TD&gt;Gender: Male; Age: 57; Race: B; County: Adams&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 06 Nov 2022 14:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842744#M333226</guid>
      <dc:creator>SP01</dc:creator>
      <dc:date>2022-11-06T14:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842747#M333228</link>
      <description>&lt;P&gt;Most of us refuse to use data in Excel, because downloading Microsoft Office documents is a security risk.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide a portion of your data as working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;instructions&lt;/A&gt;), and not in other formats including Excel or screen captures.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 13:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842747#M333228</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-06T13:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842748#M333229</link>
      <description>&lt;P&gt;Thank you for the response. Below is the structure I need to have from working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Sources&lt;/TD&gt;&lt;TD&gt;Total number&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Category&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Census&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;Gender: Female; Age: 20; Race: W; County: Lancaster&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Working dataset&lt;/TD&gt;&lt;TD&gt;67&lt;/TD&gt;&lt;TD&gt;Gender: Female; Age: 20; Race: W; County: Lancaster&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Empty records need&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;Gender: Female; Age: 20; Race: W; County: Lancaster&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Census&lt;/TD&gt;&lt;TD&gt;95&lt;/TD&gt;&lt;TD&gt;Gender: Male; Age: 57; Race: B; County: Adams&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Working dataset&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;Gender: Male; Age: 57; Race: B; County: Adams&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Empty records need&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;TD&gt;Gender: Male; Age: 57; Race: B; County: Adams&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 06 Nov 2022 14:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842748#M333229</guid>
      <dc:creator>SP01</dc:creator>
      <dc:date>2022-11-06T14:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842750#M333231</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I have a task to create a working population dataset. My working dataset A has row level information by age, race, sex, and county. I need to count records by these variables and then add required records from dataset B to have full population.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you mean by "add required records from data set B"? You don't present anything that looks like data set B. Add to what? Where do "empty records" enter into this, that isn't explained either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, repeating my request with emphasis&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please provide a portion of your data as working SAS data step code (&lt;/SPAN&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self" rel="nofollow noopener noreferrer"&gt;instructions&lt;/A&gt;&lt;SPAN&gt;), &lt;FONT color="#FF6600"&gt;&lt;EM&gt;&lt;STRONG&gt;and not in other formats including Excel or screen captures.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 14:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842750#M333231</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-06T14:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842751#M333232</link>
      <description>&lt;P&gt;My apologies for not being clear, Paige!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data HaveA&lt;BR /&gt;datalines ID age gender&amp;nbsp; &amp;nbsp;race&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ethnicity&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;county&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; 12&amp;nbsp; &amp;nbsp; M&amp;nbsp; &amp;nbsp; AmericanIndian Non-Hispanic&amp;nbsp; &amp;nbsp;Lancaster&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp;26&amp;nbsp; &amp;nbsp;M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;UNK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hispanic&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Douglas&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp;34&amp;nbsp; &amp;nbsp;M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;UNK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UNK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Sarpy&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp;41&amp;nbsp; &amp;nbsp; F&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Asian&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Non-Hispanic&amp;nbsp; &amp;nbsp;Douglas&lt;/P&gt;&lt;P&gt;data Have B is census dataset and has complete age, race , se, county, ethnicity information.&lt;BR /&gt;So if the count of combination of Age = 12, Gender = M, Race = AmericanIndian, Ethnicity = Non-hispanic, county = Lancaster is 60 and for the same combination in census file (HaveB) we have 100, I need to add 40 records with this combination to balance.&lt;BR /&gt;Lets say I have 1.4 million of these records. I need to count these by each combination type and then fill or add empty records or records from census population with complete population information. So, I would be completing 1.4 million from HaveA to 1.9 million from HaveB by using counts from these combinations. I hope I make some sense here. Thank you again.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 14:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842751#M333232</guid>
      <dc:creator>SP01</dc:creator>
      <dc:date>2022-11-06T14:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842758#M333235</link>
      <description>&lt;P&gt;What does data set B look like? You only provided half, it not less, of the problem description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I actually don't understand what your final result is supposed to look like and/or any rules that would be used to make it.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Note: in the long run you will find any data that places more than one value into a variable is extremely awkward to work with. So those Category values should likely be split into 4 (or possibly more, hard to tell from partial examples) variable, one each for Gender, Age, Race and County.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 15:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842758#M333235</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-06T15:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842793#M333255</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432452"&gt;@SP01&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;It appears you are trying to join two datasets using common variable.&lt;BR /&gt;Consider using data step merge using&amp;nbsp; common by variables.&lt;BR /&gt;Alternatively consider using Proc SQL join.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 22:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842793#M333255</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-11-06T22:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create empty records from census data to working dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842800#M333259</link>
      <description>&lt;P&gt;I don't understand what you mean.&amp;nbsp; Why would need to create observations?&lt;/P&gt;
&lt;P&gt;If you have a count of 65 and another count of 100 to figure out that the difference is 35 you just need to subtract.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as 
select category
        , a.count as CENSUS
        , b.count as PRESENT
        , a.count - b.count as NOT_PRESENT
from census a
inner join present b
on a.category = b.category
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Nov 2022 00:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-empty-records-from-census-data-to-working/m-p/842800#M333259</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-07T00:44:43Z</dc:date>
    </item>
  </channel>
</rss>

