<?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: SELECTED REGION WISE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/953601#M372539</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/471677"&gt;@quran&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may have missed the objective of the original poster, or perhaps didn't notice the structure of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The OP wanted "every country" in the two specified regions.&amp;nbsp; But unfortunately there is no Excel column (thus no imported SAS variable) that identifies the region for every observation.&amp;nbsp; Instead, there are rows with the region identified in the variable&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;Reporting_Country_Territory_Area&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; Luckily the word "Region" appears in this variable for all such rows and only those rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following those rows are a series of countries (also identified in &lt;EM&gt;&lt;STRONG&gt;Reporting_Country_Territory_Area&lt;/STRONG&gt;&lt;/EM&gt;) that belong to the identified region.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code retrieves only the two rows that identify the desired regions, but none of the rows following them.&amp;nbsp; That is what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;'s code addresses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you intend to make the subset for WANT directly from COVID19 imported dataset, then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set covid19 ;
  length region $47;
  retain region;

  if findw(Reporting_Country_Territory_Area,'Region') then region=reporting_country_territory_area;
  else if region in ('Western Pacific Region' 'South-East Asia Region') then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can just create the COVID19_EXPANNDED data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data covid19_expanded;
  set covid19 ;
  length region $47;
  retain region;

  if findw(Reporting_Country_Territory_Area,'Region') then region=reporting_country_territory_area;
  else output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you could use the WHERE filter that you propose.&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>Sun, 15 Dec 2024 01:20:16 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2024-12-15T01:20:16Z</dc:date>
    <item>
      <title>SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636130#M188929</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	proc import datafile ="C:\Users\Anand\Desktop\covid19 updated_onMar31-2020.xlsx"
	out=covid19 
	dbms=xlsx;
	run;
&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; data covid19a;&lt;BR /&gt;set covid19;&lt;BR /&gt;where Reporting_Country_Territory_Area in ('Western Pacific Region' 'South-East Asia Region');&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi guys&amp;nbsp;&lt;/P&gt;&lt;P&gt;gentle remainder&amp;nbsp;&lt;/P&gt;&lt;P&gt;but i didn't get proper solutions&amp;nbsp;&lt;/P&gt;&lt;P&gt;please find below attachment&amp;nbsp; and i want retrive information&amp;nbsp;&lt;/P&gt;&lt;P&gt;two regions only&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;'Western Pacific Region' 'South-East Asia Region' &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;i want above two regions countries&amp;nbsp;data&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 09:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636130#M188929</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-03-31T09:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636141#M188937</link>
      <description>&lt;P&gt;Are there any unexpected notes, warnings or errors in the log? If so, please post the log as text using "insert code" button.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 10:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636141#M188937</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-03-31T10:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636161#M188954</link>
      <description>&lt;P&gt;I stored your Excel file in my UE directory, and ran this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import
  datafile ="/folders/myfolders/covid19 updated_onMar31-2020.xlsx"
  out=covid19 
  dbms=xlsx
  replace
;
run;

data covid19a;
set covid19;
where Reporting_Country_Territory_Area in ('Western Pacific Region' 'South-East Asia Region');
run;

proc print data=covid19a noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and I got the two observations that match your WHERE condition.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 10:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636161#M188954</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-31T10:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636188#M188970</link>
      <description>Post output what you have got&lt;BR /&gt;I want all countries in both regions</description>
      <pubDate>Tue, 31 Mar 2020 12:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636188#M188970</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2020-03-31T12:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636194#M188975</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Post output what you have got&lt;BR /&gt;I want all countries in both regions&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;With the current structure, this is not possible. It seems that you need to convert a report-style layout to a correct table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import
  datafile ="/folders/myfolders/covid19 updated_onMar31-2020.xlsx"
  out=covid19 
  dbms=xlsx
  replace
;
run;

data covid19_expanded;
length region $47;
set covid19;
retain region;
if
  total_confirmed_cases = . /* "region" line */
then do;
  if reporting_country_territory_area ne "Territories**"
  /* otherwise the two "Territories**" groups form their own region */
  then region = reporting_country_territory_area;
  delete; /* we don't want this extra observation in the dataset */
end;
run;

data want;
set covid19_expanded;
where region in ('Western Pacific Region' 'South-East Asia Region');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/636194#M188975</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-31T12:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/953576#M372525</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE class=""&gt;&lt;CODE class=""&gt;&lt;SPAN class=""&gt;proc import &lt;/SPAN&gt;datafile =&lt;SPAN class=""&gt;"C:\Users\Anand\Desktop\covid19 updated_onMar31-2020.xlsx"&lt;/SPAN&gt;
	&lt;SPAN class=""&gt;out&lt;/SPAN&gt;=covid19 
	dbms=xlsx;
&lt;SPAN class=""&gt;run;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;data &lt;/SPAN&gt;covid19a;
  &lt;SPAN class=""&gt;set&lt;/SPAN&gt; covid19;
  &lt;SPAN class=""&gt;where&lt;/SPAN&gt; Reporting_Country_Territory_Area &lt;SPAN class=""&gt;in&lt;/SPAN&gt; (&lt;SPAN class=""&gt;'Western Pacific Region'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'South-East Asia Region'&lt;/SPAN&gt;);
&lt;SPAN class=""&gt;run;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;proc print &lt;/SPAN&gt;data=covid19a;
&lt;SPAN class=""&gt;run;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;This code will:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Import the data:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Reads the Excel file &lt;CODE&gt;covid19 updated_onMar31-2020.xlsx&lt;/CODE&gt; from the specified path.&lt;/LI&gt;&lt;LI&gt;Creates a SAS dataset named &lt;CODE&gt;covid19&lt;/CODE&gt; from the imported data.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Filter the data:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Creates a new dataset &lt;CODE&gt;covid19a&lt;/CODE&gt; containing only the rows where the region&lt;CODE&gt;Reporting_Country_Territory_Area&lt;/CODE&gt; is either 'Western Pacific Region' or 'South-East Asia Region.'.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Print the filtered data:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Displays the contents of the &lt;CODE&gt;covid19a&lt;/CODE&gt; dataset.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This refined code addresses the issue in the original code by correctly specifying the &lt;CODE&gt;where&lt;/CODE&gt; clause to filter for the two desired regions.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2024 07:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/953576#M372525</guid>
      <dc:creator>quran</dc:creator>
      <dc:date>2024-12-14T07:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: SELECTED REGION WISE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/953601#M372539</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/471677"&gt;@quran&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may have missed the objective of the original poster, or perhaps didn't notice the structure of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The OP wanted "every country" in the two specified regions.&amp;nbsp; But unfortunately there is no Excel column (thus no imported SAS variable) that identifies the region for every observation.&amp;nbsp; Instead, there are rows with the region identified in the variable&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;Reporting_Country_Territory_Area&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; Luckily the word "Region" appears in this variable for all such rows and only those rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Following those rows are a series of countries (also identified in &lt;EM&gt;&lt;STRONG&gt;Reporting_Country_Territory_Area&lt;/STRONG&gt;&lt;/EM&gt;) that belong to the identified region.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code retrieves only the two rows that identify the desired regions, but none of the rows following them.&amp;nbsp; That is what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;'s code addresses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you intend to make the subset for WANT directly from COVID19 imported dataset, then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set covid19 ;
  length region $47;
  retain region;

  if findw(Reporting_Country_Territory_Area,'Region') then region=reporting_country_territory_area;
  else if region in ('Western Pacific Region' 'South-East Asia Region') then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can just create the COVID19_EXPANNDED data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data covid19_expanded;
  set covid19 ;
  length region $47;
  retain region;

  if findw(Reporting_Country_Territory_Area,'Region') then region=reporting_country_territory_area;
  else output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you could use the WHERE filter that you propose.&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>Sun, 15 Dec 2024 01:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SELECTED-REGION-WISE/m-p/953601#M372539</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-12-15T01:20:16Z</dc:date>
    </item>
  </channel>
</rss>

