<?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 to pick some paticular year in each country data to concatenate together in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717567#M221927</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data treatment;
		set have.wins_sample ;
		where (GEOGN="ARGENTINA") or
              (YEAR in ('2001','2002','2004','2005', '2006','2007','2008') and GEOGN= "AUSTRALIA") or
              (YEAR in ('2004','2005','2007','2008','2009','2010','2011')  and GEOGN= "AUSTRIA");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Did you try this?&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2021 13:49:34 GMT</pubDate>
    <dc:creator>jarapoch</dc:creator>
    <dc:date>2021-02-08T13:49:34Z</dc:date>
    <item>
      <title>How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717536#M221921</link>
      <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today I want to pick some specific observations in each country in one dataset named "&lt;STRONG&gt;wins_sample&lt;/STRONG&gt;" to create a new dataset called "&lt;STRONG&gt;treatment&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;I have the dataset &lt;STRONG&gt;wins_sample&lt;/STRONG&gt; attached&lt;/P&gt;
&lt;P&gt;A quick description of observation of the dataset &lt;STRONG&gt;wins_sample&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;TYPE	ENAME	    GEOGN	    YEAR	acc_pay	ACC_PAY_TUR	    ACC_STA
134495	DYCASA 'B'	ARGENTINA	1994	7445	.	            Local standards
134495	DYCASA 'B'	ARGENTINA	1995	10099	8.7216142271	
134495	DYCASA 'B'	ARGENTINA	1996	6277	8.0189301417	Local standards
134495	DYCASA 'B'	ARGENTINA	1997	8419	11.732035928	Local standards
134495	DYCASA 'B'	ARGENTINA	1998	15387	7.5126438713	Local standards&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*type, year, acc_sta geogn: character variables&lt;BR /&gt;acc_pay, acc_pay_tur: numeric variables*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The dataset &lt;STRONG&gt;wins_sample&amp;nbsp;&lt;/STRONG&gt;here has 3 countries: Argentina, Australia, and Austria.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this sample, what I want is to create a dataset named "&lt;STRONG&gt;treatment&lt;/STRONG&gt;" that contains all observations which has YEAR from 2001,2002, 2004-&amp;gt;2008 (from 2001 to 2008 but not the observations in the year 2003) in GEOGN= "AUSTRALIA" and all observations which has YEAR from 2004,2005, 2007-&amp;gt;2011 in GEOGN ="AUSTRIA"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks in advance and warm regards.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 10:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717536#M221921</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-08T10:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717537#M221922</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where
  (geogn = "AUSTRIA" and 2004 le year le 2011 and year ne 2006) or
  (/* add similar for AUSTRALIA */)
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2021 10:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717537#M221922</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-08T10:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717540#M221923</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you store the year values in a numeric variable, then you don't need the conversion using the INPUT function as shown below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data treatment(drop=yr);
set wins_sample;
yr=input(year, ?? 32.);
if  geogn="AUSTRALIA" &amp;amp; yr in (2001:2008) &amp;amp; yr~=2003
  | geogn="AUSTRIA"   &amp;amp; yr in (2004:2011) &amp;amp; yr~=2006
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2021 10:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717540#M221923</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-02-08T10:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717567#M221927</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data treatment;
		set have.wins_sample ;
		where (GEOGN="ARGENTINA") or
              (YEAR in ('2001','2002','2004','2005', '2006','2007','2008') and GEOGN= "AUSTRALIA") or
              (YEAR in ('2004','2005','2007','2008','2009','2010','2011')  and GEOGN= "AUSTRIA");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Did you try this?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 13:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717567#M221927</guid>
      <dc:creator>jarapoch</dc:creator>
      <dc:date>2021-02-08T13:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717702#M221982</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure if the highlighted symbol here is "or"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1612809827959.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54477iA46A4E2F70AC2515/image-size/medium?v=v2&amp;amp;px=400" role="button" title="My97_0-1612809827959.png" alt="My97_0-1612809827959.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Sorry I am not sure about this symbol from google so I ask.&lt;/P&gt;
&lt;P&gt;Because there is a link about operator&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=p00iah2thp63bmn1lt20esag14lh.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=p00iah2thp63bmn1lt20esag14lh.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And many types of "OR"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_1-1612809958353.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54478iCC4F788DB76C14AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="My97_1-1612809958353.png" alt="My97_1-1612809958353.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 18:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717702#M221982</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-08T18:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717709#M221983</link>
      <description>&lt;P&gt;Yes, the pipe character (&lt;FONT face="courier new,courier"&gt;|&lt;/FONT&gt;) is the OR operator (see second row in the table "Logical Operators"). But feel free to use the mnemonics &lt;FONT face="courier new,courier"&gt;or&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;and&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;ne&lt;/FONT&gt;, etc. if you're more familiar with them or if the dependence on the operating environment (see footnotes under&amp;nbsp;the table "Logical Operators") is a concern.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 19:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717709#M221983</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-02-08T19:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717786#M222031</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if I want to pick observation in country GEOGN="BRAZIL" and from "1991-&amp;gt;1997"( excluding 1993) or "2007 -&amp;gt;2017", can you suggest to me how to fill in the code below?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data control;&lt;BR /&gt;set wins.winsorize;&lt;BR /&gt;yr=input(year, ?? 32.);&lt;BR /&gt;if geogn="UNITEDS"        &amp;amp; yr in (1999:2017)&lt;BR /&gt;   |geogn="BRAZIL"        &amp;amp; yr in (1991:1997) &amp;amp; yr~=1993 /*and what else*/&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can we do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;geogn="BRAZIL"        &amp;amp; ((yr in (1991:1997) &amp;amp; yr~=1993)or yr in (2007:2017))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 08:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717786#M222031</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-09T08:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to pick some paticular year in each country data to concatenate together</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717799#M222040</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if I want to pick observation in country GEOGN="BRAZIL" and from "1991-&amp;gt;1997"( excluding 1993) or "2007 -&amp;gt;2017", can you suggest to me how to fill in the code below?&lt;/P&gt;
&lt;P&gt;(...)&lt;/P&gt;
&lt;P&gt;Can we do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;geogn="BRAZIL"        &amp;amp; (&lt;FONT color="#00CCFF"&gt;(&lt;/FONT&gt;yr in (1991:1997) &amp;amp; yr~=1993&lt;FONT color="#00CCFF"&gt;)&lt;/FONT&gt;or yr in (2007:2017))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, this is correct. The parentheses which I've highlighted in blue below are redundant, but they may help to understand the logic. I would insert a blank between ")" and "or" for better readability.&lt;/P&gt;
&lt;PRE&gt;geogn="BRAZIL" &amp;amp; (&lt;FONT color="#00CCFF"&gt;(&lt;/FONT&gt;yr in (1991:1997) &amp;amp; yr~=1993&lt;FONT color="#00CCFF"&gt;) &lt;/FONT&gt;or yr in (2007:2017))&lt;/PRE&gt;
&lt;P&gt;If you're unsure about a logical condition like this, you can also create a small test dataset with the relevant variables (&lt;FONT face="courier new,courier"&gt;geogn&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;yr&lt;/FONT&gt;), let &lt;FONT face="courier new,courier"&gt;yr&lt;/FONT&gt; run from, say, 1990 to 2020 (DO loop), apply the IF condition and check the result.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 08:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pick-some-paticular-year-in-each-country-data-to/m-p/717799#M222040</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-02-09T08:29:26Z</dc:date>
    </item>
  </channel>
</rss>

