<?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 correlations by year group and post  for 2 variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/correlations-by-year-group-and-post-for-2-variables/m-p/862430#M340672</link>
    <description>&lt;P&gt;Dear users,&lt;/P&gt;&lt;P&gt;My data is attached.&lt;/P&gt;&lt;P&gt;I want to run correlations for each year, for all 3 groups between GDP and zscore.&lt;/P&gt;&lt;P&gt;for example: for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=1 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=2 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=3 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2003&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=1 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2003&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=2 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2003&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=3 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;do that for all years in data and get the results in a nice table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question: If I want to add conditions for groups with ordinal_adoption1 or 2 so the correlation will only consider post=1 in the years - how to add that variable (in group ordinal_adoption=1 post=0 always) ? for example:&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=2 between&amp;nbsp;GDP and zscore, only when post=1.&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=3 between&amp;nbsp;GDP and zscore.only when post=1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 07:50:44 GMT</pubDate>
    <dc:creator>HEB1</dc:creator>
    <dc:date>2023-03-06T07:50:44Z</dc:date>
    <item>
      <title>correlations by year group and post  for 2 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/correlations-by-year-group-and-post-for-2-variables/m-p/862430#M340672</link>
      <description>&lt;P&gt;Dear users,&lt;/P&gt;&lt;P&gt;My data is attached.&lt;/P&gt;&lt;P&gt;I want to run correlations for each year, for all 3 groups between GDP and zscore.&lt;/P&gt;&lt;P&gt;for example: for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=1 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=2 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=3 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2003&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=1 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2003&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=2 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;for year 2003&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=3 between&amp;nbsp;GDP and zscore.&lt;/P&gt;&lt;P&gt;do that for all years in data and get the results in a nice table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question: If I want to add conditions for groups with ordinal_adoption1 or 2 so the correlation will only consider post=1 in the years - how to add that variable (in group ordinal_adoption=1 post=0 always) ? for example:&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=2 between&amp;nbsp;GDP and zscore, only when post=1.&lt;/P&gt;&lt;P&gt;for year 2002&amp;nbsp; &amp;nbsp;I want to calculate correlation for ordinal adoption=3 between&amp;nbsp;GDP and zscore.only when post=1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 07:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/correlations-by-year-group-and-post-for-2-variables/m-p/862430#M340672</guid>
      <dc:creator>HEB1</dc:creator>
      <dc:date>2023-03-06T07:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: correlations by year group and post  for 2 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/correlations-by-year-group-and-post-for-2-variables/m-p/862452#M340679</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I want to run correlations for each year, for all 3 groups between GDP and zscore.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use PROC CORR with a BY statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc corr data=have;
    by year ordinal_adoption;
    var gdp zscore;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Another question: If I want to add conditions for groups with ordinal_adoption1 or 2 so the correlation will only consider post=1 in the years - how to add that variable&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeat the above code adding a WHERE statement.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 10:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/correlations-by-year-group-and-post-for-2-variables/m-p/862452#M340679</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-06T10:22:30Z</dc:date>
    </item>
  </channel>
</rss>

