<?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 set up multiple conditonal code ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747579#M234663</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37107"&gt;@jimbarbour&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a couple of questions in advance here, your code is quite a bit beyond my knowledge so I need to print it out and read it carefully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. What does the fourth dimension in your macro Set_PT mean? I did not see you refer it previously.&lt;/P&gt;
&lt;P&gt;2. What is the purpose of creating the dataset "Matching" with not continuous years like that? Or as you said, you just used the number already from my post? Ahh, or do you mean "&lt;STRONG&gt;matching&lt;/STRONG&gt;" is my original dataset? So, does it mean that, in my case, I can create a dataset Nations_Cnt directly by using PROC SQL from dataset matching without creating the dataset Law_Years like your?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. whether the code&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;%PUT  NOTE:  &amp;amp;=Nations_Cnt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;just to write down to the log that we are heading to a specific country?&lt;/P&gt;
&lt;P&gt;4. And I believe that, you write some abbreviation with purpose, can I ask what do "DSN_Nrb" and "Nations_Cnt" stand for, that I can explain these words and the situation easier?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;
&lt;P&gt;Phil.&lt;/P&gt;</description>
    <pubDate>Sun, 13 Jun 2021 00:52:26 GMT</pubDate>
    <dc:creator>Phil_NZ</dc:creator>
    <dc:date>2021-06-13T00:52:26Z</dc:date>
    <item>
      <title>How to set up multiple conditonal code ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747518#M234624</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Have a fabulous weekend,&lt;/P&gt;
&lt;P&gt;I have a conditional code below&lt;/P&gt;
&lt;P&gt;The idea is that: my dataset for these countries is from 1989 to 2020 (yr from 1989 to 2020). But I just want to keep the sample from &lt;STRONG&gt;1990 to 2020&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Afterward, I want to create a variable called &lt;STRONG&gt;pt&lt;/STRONG&gt;. The &lt;STRONG&gt;pt&lt;/STRONG&gt; variable receive the value of &lt;STRONG&gt;0 if geogn="UNITEDS" and the year is from 1990 to 1992 (one year before 1993) and&amp;nbsp;&lt;/STRONG&gt;receiving the value of &lt;STRONG&gt;1 if geogn="UNITEDS" and the year is from 1993 to 2020&lt;/STRONG&gt;. Similarly,&amp;nbsp; the pt variable receiving the value of 1 if geogn="&lt;CODE class=" language-sas"&gt;SOUTHKOREA&lt;/CODE&gt;" and the year is from 1997 to 2020 and receive the value of 0 from 1990 to 1996(one year before 1997).&lt;/P&gt;
&lt;P&gt;A similar creation for other countries, where &lt;STRONG&gt;1993, 1997, 2000,2001, 2004, 2018 are law implementation years of the countries&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;My novice code is as below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gen_post_treat;
 set matching;
 yr=input(year, ?? 32.);/*year is a character variable, so I convert to numeric variable*/
 if  geogn="UNITEDS"       &amp;amp; yr in (1993:2020)
   | geogn="SOUTHKOREA"    &amp;amp; yr in (1997:2020)
   | geogn="BRAZIL"        &amp;amp; yr in (2000:2020)
   | geogn="CANADA"        &amp;amp; yr in (2000:2020)
   | geogn="CZECH"         &amp;amp; yr in (2001:2020)
   | geogn="LATVIA"        &amp;amp; yr in (2004:2020)
   | geogn="VIETNAM"       &amp;amp; yr in (2018:2020)
then pt=1;
else if yr ne 1989 then pt=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And last but not least, I want to create a variable called the &lt;STRONG&gt;converted year (&lt;/STRONG&gt;named&lt;STRONG&gt; cvt_yr)&lt;/STRONG&gt;&amp;nbsp;that focuses on 9 years surrounding the &lt;STRONG&gt;law implementation years&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;For example, in&amp;nbsp;&lt;CODE class=" language-sas"&gt;SOUTHKOREA&lt;/CODE&gt; case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cvt_yr= -4 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=1993
cvt_yr= -3 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=1994
cvt_yr= -2 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=1995
cvt_yr= -1 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=1996
cvt_yr=  0 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=1997
cvt_yr= 1 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=1998
....
cvt_yr= 5 if&amp;nbsp;geogn="SOUTHKOREA"    &amp;amp; yr=2002&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Similarly&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cvt_yr= -4 if&amp;nbsp;geogn="CZECH"    &amp;amp; yr=1997&lt;/CODE&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;CODE class=" language-sas"&gt;cvt_yr= 0 if&amp;nbsp;geogn="CZECH"    &amp;amp; yr=2001&lt;/CODE&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;CODE class=" language-sas"&gt;cvt_yr= 5 if&amp;nbsp;geogn="CZECH"    &amp;amp; yr=2006&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly applied for other countries.&lt;/P&gt;
&lt;P&gt;For &lt;CODE class=" language-sas"&gt;UNITEDS&lt;/CODE&gt;, we only trace back to 1990 due to data limitation&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cvt_yr= -3 if&amp;nbsp;geogn="UNITEDS"    &amp;amp; yr=1990&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;and for Vietnam, we only trace forward to 2020 due to data limitation&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cvt_yr= 2 if&amp;nbsp;geogn="VIETNAM"    &amp;amp; yr=2020&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Please let me know if my explanation is not clear.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Thank you so much and warm regards.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Phil.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jun 2021 07:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747518#M234624</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-06-12T07:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to set up multiple conditonal code ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747572#M234658</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many ways to do this.&amp;nbsp; However, when I see the exact same process being done over and over but each time to a different entity, my mind immediately goes to macro processing.&amp;nbsp; Just as you were, I'm going to use a Data step to set PT and Cvt_Yr, but I'm going to put the Data step inside a macro wrapper and pass parameters to the macro.&amp;nbsp; Code once, parameterize, pass in parameters.&amp;nbsp; This actually minimizes code in the long run although if it's a "one and done" process that you'll never see again, it may not be worth it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is below.&amp;nbsp; Comments:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First I build a little data&amp;nbsp; set called Law_Years.&amp;nbsp; This data drives the overall process.&amp;nbsp; The nice thing about this code is that if you get additional countries, you add them to the Law_Years table and you&amp;nbsp;&lt;STRONG&gt;do not have to change any code.&lt;/STRONG&gt;&amp;nbsp; As I read each record, I load a macro array containing the GeoGn and the Law_Year.&lt;/P&gt;
&lt;P&gt;Second, I read in some test data that I just typed up based on your original post.&lt;/P&gt;
&lt;P&gt;Third, I get a count of the number of distinct nations and put it into a macro variable.&amp;nbsp; I could have gotten the count in step one, but this&amp;nbsp; step eliminates the possibility of duplicates.&lt;/P&gt;
&lt;P&gt;Fourth, I have a macro with the Data step that will be setting PT and Cvt_Yr.&amp;nbsp; Passed in as parameters are the GeoGn, the StartYr, the EndYr, and the number corresponding to a given GeoGn's position in the macro array.&amp;nbsp; An intermediate dataset will be created using this number.&lt;/P&gt;
&lt;P&gt;Fifth, I run the Data step using a second macro.&amp;nbsp; All the second macro does is iterate through the macro array, format the parameters, and invoke the first macro.&lt;/P&gt;
&lt;P&gt;Sixth, I have a little macro that all it does is list out the names of the intermediate data sets.&lt;/P&gt;
&lt;P&gt;Seventh and last, I have a step that combines all the intermediate datasets into one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Give it a try with your data and see how it goes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	Law_Years;&lt;BR /&gt;
	DROP	_:;
	LENGTH	GeoGn	$12;
	LENGTH	LawYear	$4;
	INPUT
		GeoGn	$
		LawYear
		;
	_Count	+	1;
	CALL	SYMPUTX(CATS('GeoGn', PUT(_Count, 3.)), GeoGn);
	CALL	SYMPUTX(CATS('LawYear', PUT(_Count, 3.)), LawYear);
DATALINES;
UNITEDS  1993
SOUTHKOREA  1997
BRAZIL  2000
CANADA  2000
CZECH  2001
LATVIA  2004
VIETNAM  2018
;
RUN;

DATA	Matching;
	LENGTH	GeoGn	$12;
	LENGTH	Year	$4;
	INPUT	GeoGn	$
			Year	$
			;
DATALINES;
SOUTHKOREA  1989
SOUTHKOREA  1993
SOUTHKOREA  1994
SOUTHKOREA  1995
SOUTHKOREA  1996
SOUTHKOREA  1997
SOUTHKOREA  1998
SOUTHKOREA  1999
SOUTHKOREA  2000
SOUTHKOREA  2001
SOUTHKOREA  2002
SOUTHKOREA  2021
CZECH  1989
CZECH  1997
CZECH  1998
CZECH  1999
CZECH  2000
CZECH  2001
CZECH  2002
CZECH  2003
CZECH  2004
CZECH  2005
CZECH  2006
CZECH  2021
;
RUN;

PROC	SQL	NOPRINT;
	SELECT	COUNT(DISTINCT  GeoGn)
		INTO	:	Nations_Cnt
		FROM		Law_Years;
QUIT;
%PUT  NOTE:  &amp;amp;=Nations_Cnt;

%MACRO	Set_PT(GeoGn, StartYr, EndYr, DSN_Nbr);
	DATA	gen_post_treat_&amp;amp;DSN_Nbr;
		set matching;
		yr=input(year, ?? 32.);	/*year is a character variable, so I convert to numeric variable*/

		IF	STRIP(UPCASE(GeoGn))	=	"&amp;amp;GeoGn"	AND
			1990		&amp;lt;=	Yr		&amp;lt;=	2020;

		IF	&amp;amp;StartYr	&amp;lt;=	Yr		&amp;lt;=	&amp;amp;EndYr		THEN
			PT						=	1;
		ELSE
			PT						=	0;

		Cvt_Yr						=	Yr	-	&amp;amp;StartYr;
	RUN;
%MEND	Set_PT;

%MACRO	Create_Datasets;
	%LOCAL	i;
	%DO	i	=	1	%TO	&amp;amp;Nations_Cnt;
		%Set_PT(&amp;amp;&amp;amp;GeoGn&amp;amp;i,	&amp;amp;&amp;amp;LawYear&amp;amp;i, 2020, &amp;amp;i);
	%END;
%MEND	Create_Datasets;
%Create_Datasets;

%MACRO	List_Dataset_Names;
	%LOCAL	i;
	%DO	i	=	1	%TO	&amp;amp;Nations_Cnt;
		Gen_Post_Treat_%SYSFUNC(STRIP(&amp;amp;i))
	%END;
%MEND	List_Dataset_Names;

DATA	Gen_Post_Treat;
	SET
		%List_Dataset_Names;
		;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2021 00:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747572#M234658</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-06-13T00:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to set up multiple conditonal code ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747579#M234663</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37107"&gt;@jimbarbour&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a couple of questions in advance here, your code is quite a bit beyond my knowledge so I need to print it out and read it carefully.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. What does the fourth dimension in your macro Set_PT mean? I did not see you refer it previously.&lt;/P&gt;
&lt;P&gt;2. What is the purpose of creating the dataset "Matching" with not continuous years like that? Or as you said, you just used the number already from my post? Ahh, or do you mean "&lt;STRONG&gt;matching&lt;/STRONG&gt;" is my original dataset? So, does it mean that, in my case, I can create a dataset Nations_Cnt directly by using PROC SQL from dataset matching without creating the dataset Law_Years like your?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. whether the code&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;%PUT  NOTE:  &amp;amp;=Nations_Cnt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;just to write down to the log that we are heading to a specific country?&lt;/P&gt;
&lt;P&gt;4. And I believe that, you write some abbreviation with purpose, can I ask what do "DSN_Nrb" and "Nations_Cnt" stand for, that I can explain these words and the situation easier?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;
&lt;P&gt;Phil.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2021 00:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747579#M234663</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-06-13T00:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set up multiple conditonal code ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747584#M234666</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;1. What does the fourth dimension in your macro Set_PT mean? I did not see you refer it previously.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;, the macro processes one country at a time.&amp;nbsp; The Data step writes out a file named, "gen_post_treat."&amp;nbsp; However, if I use the same filename for every country, the 2nd country will overwrite the first, the 3rd the 2nd, and so on.&amp;nbsp; So what I do is pass in the fourth parameter, &amp;amp;i.&amp;nbsp; The macro variable &amp;amp;i is just a number, a counter, that starts at one and goes up to however many countries there are in your Law_Year table.&amp;nbsp; This number is suffixed onto the file name so that an intermediate file is created with a unique name for each country.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&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;2. What is the purpose of creating the dataset "Matching" with not continuous years like that? Or as you said, you just used the number already from my post?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, mostly I took the examples from your original post.&amp;nbsp; I added 1989 and 2021 to test years that fall out of the range of consideration.&amp;nbsp; Basically, anything that is before 1990 or after 2020, we want to exclude.&amp;nbsp; By putting 1989 and 2021 into the data, I test my range.&amp;nbsp; If my code filters out 1989 and 2021, then I have validated that the code is working properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&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;3. whether the code&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%PUT  NOTE:  &amp;amp;=Nations_Cnt;&lt;/LI-CODE&gt;
&lt;P&gt;just to write down to the log that we are heading to a specific country?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;%PUT does indeed write to the log.&amp;nbsp; The %PUT immediately follows a Proc SQL step that creates a macro variable.&amp;nbsp; I want to know if the value of the macro variable is correct, so I write it to the log.&amp;nbsp; In the log, it looks like the below.&amp;nbsp; Nations count is simple a count of how many nations there are in the Law_Year table.&amp;nbsp; In this case, there are seven (US, S Korea, Brazil, Canada, Czech Republic, Latvia, and Vietnam).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1623545252760.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60308iFD6B76F45ED843A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1623545252760.png" alt="jimbarbour_0-1623545252760.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&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;4. And I believe that, you write some abbreviation with purpose, can I ask what do "DSN_Nrb" and "Nations_Cnt" stand for, that I can explain these words and the situation easier?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;DSN_Nbr is just a number from one to the number of nations.&amp;nbsp; Nations_Cnt is a count of the number of nations in the Law_Year table.&amp;nbsp; You gave 7 examples in your original post.&amp;nbsp; Elsewhere you mentioned that there are I believe 64.&amp;nbsp; "DSN" stands for &lt;U&gt;D&lt;/U&gt;ata &lt;U&gt;S&lt;/U&gt;et &lt;U&gt;N&lt;/U&gt;ame.&amp;nbsp; Therefore DSN_Nbr is the number that is suffixed on to the back end of the data set name to make each data set name unique.&lt;/P&gt;
&lt;P&gt;Here, below, using the examples from your original post, are the intermediate data sets I created, one for each country.&amp;nbsp; Notice how there is a number on the back end of each dataset name.&amp;nbsp; The number on the back of each dataset name is the dataset name number or DSN_Nbr.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_1-1623545664741.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60309i3FFDB8D48212192E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_1-1623545664741.png" alt="jimbarbour_1-1623545664741.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope that helps, but this can't be easy code if someone is new to SAS.&amp;nbsp; However, you did ask for code that would make the job of working with 64 nations easier, so...&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the Data step, I'm excluding all the data that is not applicable &lt;EM&gt;and&lt;/EM&gt; setting all the values doing everything in &lt;STRONG&gt;just three commands&lt;/STRONG&gt;: Two IF statements and one mathematical expression.&amp;nbsp; I can't make it much more concise than that.&amp;nbsp; Three commands for 64 nations is fairly reasonable I think.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2021 00:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-up-multiple-conditonal-code/m-p/747584#M234666</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-06-13T00:57:54Z</dc:date>
    </item>
  </channel>
</rss>

