<?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 flag increases in variables that are in two datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859450#M339559</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/360788"&gt;@xxartpopxx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Paige&lt;/P&gt;
&lt;P&gt;variables gender_old and gender_new for instance are already in the joined table.&lt;/P&gt;
&lt;P&gt;what would the datastep look like to flag the differences between these&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like a data step where you merge the two outputs from PROC FREQ, do a subtraction, and then and IF statement to determine if you have &amp;gt;100 or &amp;lt;0&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2023 19:53:14 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-02-17T19:53:14Z</dc:date>
    <item>
      <title>How do I flag increases in variables that are in two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859428#M339552</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I have two different datasets. One from the week prior and one for this week looking at various variables such as gender, sex, race and age (all categorical variables). I have joined the two datasets in the first step below in a proc sql (table joined). This creates old and new variables from each dataset. I am stuck on how to create a flag variable for significant increases/decreases of each variable in a proc freq that I can output. I want to know if any of the gender_new categories (current week) increased/decreased by 100+ from gender_old categories (week prior).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc sql;&lt;BR /&gt;create table joined as&lt;BR /&gt;select coalesce(a.person_key, b.person_key) as person_key,&lt;BR /&gt;a.gender_old, b.gender_new,&lt;BR /&gt;a.sexor_old, b.sexor_new,&lt;BR /&gt;a.race_cd_old, b.race_cd_new,&lt;BR /&gt;a.age_group_old, b.age_group_new,&lt;BR /&gt;a.sex_old, b.sex_new,&lt;BR /&gt;a.peh1_old, b.peh1_new,&lt;BR /&gt;a.peh2_old, b.peh2_new,&lt;BR /&gt;a.dose_total_old, b.dose_total_new&lt;BR /&gt;from oldperson a&lt;BR /&gt;full join newperson b&lt;BR /&gt;on a.person_key = b.person_key;&lt;BR /&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;/&lt;EM&gt;Create Flag Variable&lt;/EM&gt;/&lt;/P&gt;&lt;P&gt;Flag significant increases and flag ANY drops. o Flag increase of 100+ for all metrics o Flag any drops for all metrics&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859428#M339552</guid>
      <dc:creator>xxartpopxx</dc:creator>
      <dc:date>2023-02-17T19:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I flag increases in variables that are in two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859429#M339553</link>
      <description>&lt;P&gt;PROC FREQ will give you the counts of Gender_New and Gender_Old. You can ask PROC FREQ to create SAS data sets for each with the counts. Then you merge the two data sets, do a subtraction and if the difference is less than 0 or greater than 100, you set a flag.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Joining the two data sets doesn't even seem like a necessary step.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859429#M339553</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-17T19:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I flag increases in variables that are in two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859435#M339554</link>
      <description>&lt;P&gt;Hi Paige&lt;/P&gt;&lt;P&gt;variables gender_old and gender_new for instance are already in the joined table.&lt;/P&gt;&lt;P&gt;what would the datastep look like to flag the differences between these&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859435#M339554</guid>
      <dc:creator>xxartpopxx</dc:creator>
      <dc:date>2023-02-17T19:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I flag increases in variables that are in two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859450#M339559</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/360788"&gt;@xxartpopxx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Paige&lt;/P&gt;
&lt;P&gt;variables gender_old and gender_new for instance are already in the joined table.&lt;/P&gt;
&lt;P&gt;what would the datastep look like to flag the differences between these&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like a data step where you merge the two outputs from PROC FREQ, do a subtraction, and then and IF statement to determine if you have &amp;gt;100 or &amp;lt;0&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859450#M339559</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-17T19:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I flag increases in variables that are in two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859489#M339569</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/360788"&gt;@xxartpopxx&lt;/a&gt;&amp;nbsp;If you provide representative sample data via a working SAS data step that we just can copy/paste to create the data, show us the desired outcome and explain the logic you have in mind to get from have to want then there is a good chance that someone will answer your question by providing working SAS code.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 00:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-flag-increases-in-variables-that-are-in-two-datasets/m-p/859489#M339569</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-18T00:50:48Z</dc:date>
    </item>
  </channel>
</rss>

