<?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: Assign Zero Value to Age_Groups for Rate Analysis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612498#M178742</link>
    <description>&lt;P&gt;Thank you all so very much!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get the solution posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt; to work. And the code posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; also worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So grateful for the help from both of you and the Programming community! I was soooo frustrated over the weekend and yesterday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2019 18:37:22 GMT</pubDate>
    <dc:creator>psnorrod</dc:creator>
    <dc:date>2019-12-17T18:37:22Z</dc:date>
    <item>
      <title>Assign Zero Value to Age_Groups for Rate Analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612486#M178732</link>
      <description>&lt;P&gt;Hello All!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Learning SAS user back again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with ecological data, and (&lt;STRONG&gt;thanks to the SAS community!!!&lt;/STRONG&gt;) successfully used code that counts the number of events across three variables (year, sex, age_group). The data is all events, so there are no "zeros" in the original data set. Now, I need to either generate zeros for the missing groups that do not have events or merge a data set that has "zeros" using a conditional statement. My final intent is to obtain rates using PROC GENMOD employing a nb or zero-inflated model. All that said, I'm uncertain as to how to generate or create the zeros in the sql data set for my final analysis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Code to create the count&lt;/EM&gt;&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table work.sql as&lt;BR /&gt;select year, sex, age_group, count(*) as count&lt;BR /&gt;from one&lt;BR /&gt;group by year, sex, age_group&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variables: year, site, sex=1 or 2, age_group=1, 2, or 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample sql data set:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;year&amp;nbsp;&amp;nbsp; site&amp;nbsp; sex&amp;nbsp; age_group&amp;nbsp; counts&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2003 &amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;/P&gt;&lt;P&gt;2003&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;/P&gt;&lt;P&gt;2003&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17&lt;/P&gt;&lt;P&gt;2003&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;2003&amp;nbsp;&amp;nbsp; 66&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you likely see, there are no counts or "zeros" for age_groups 1 and 2 where sex=2 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for all of your help!&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>Tue, 17 Dec 2019 18:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612486#M178732</guid>
      <dc:creator>psnorrod</dc:creator>
      <dc:date>2019-12-17T18:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Zero Value to Age_Groups for Rate Analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612491#M178735</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202926"&gt;@psnorrod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the sparse option in PROC FREQ&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=one noprint;
	tables year * sex * age_group / out=sql (drop=percent) sparse;
	weight counts;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NB: I believe that the variable COUNTS is the weight variable but not sure. Please feel free to remove it.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612491#M178735</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-17T18:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Zero Value to Age_Groups for Rate Analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612495#M178739</link>
      <description>working on running now.</description>
      <pubDate>Tue, 17 Dec 2019 18:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612495#M178739</guid>
      <dc:creator>psnorrod</dc:creator>
      <dc:date>2019-12-17T18:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Zero Value to Age_Groups for Rate Analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612496#M178740</link>
      <description>&lt;P&gt;One approach might be the Proc Summary with the COMPLETETYPES options using your SAMPLE1 data set from your other question:&lt;/P&gt;
&lt;PRE&gt;proc summary data=sample1 completetypes nway;
 class year sex age_group;
 output out=work.summary (drop=_type_ rename=(_freq_=count));
run;&lt;/PRE&gt;
&lt;P&gt;which will have ALL of the class variable levels with counts of 0 for the ones that did not actually occur. So you will sex 1 &amp;amp; 2 with age_group 1, 2 &amp;amp; 3 for each year.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612496#M178740</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-17T18:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Zero Value to Age_Groups for Rate Analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612498#M178742</link>
      <description>&lt;P&gt;Thank you all so very much!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get the solution posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt; to work. And the code posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; also worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So grateful for the help from both of you and the Programming community! I was soooo frustrated over the weekend and yesterday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612498#M178742</guid>
      <dc:creator>psnorrod</dc:creator>
      <dc:date>2019-12-17T18:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Zero Value to Age_Groups for Rate Analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612499#M178743</link>
      <description>&lt;P&gt;My pleasure&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202926"&gt;@psnorrod&lt;/a&gt;&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 18:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-Zero-Value-to-Age-Groups-for-Rate-Analysis/m-p/612499#M178743</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-17T18:38:08Z</dc:date>
    </item>
  </channel>
</rss>

