<?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: Macros and year loop can't find my files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600352#M173515</link>
    <description>&lt;PRE&gt;&amp;amp;datenname.&amp;amp;year&lt;/PRE&gt;
&lt;P&gt;will resolve to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drg2005&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and not your intended name. Use&lt;/P&gt;
&lt;PRE&gt;&amp;amp;datenname.&amp;amp;year._sf&lt;/PRE&gt;
&lt;P&gt;to append the necessary suffix.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2019 12:18:23 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-10-30T12:18:23Z</dc:date>
    <item>
      <title>Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600350#M173514</link>
      <description>&lt;P&gt;Hey guys,&lt;BR /&gt;I have to write a syntax and give it to an institute where they will check it and let it run with the original database.&lt;BR /&gt;I just have a Test/Dummy data Base.&lt;BR /&gt;I want to get my results from every year from 2005 to 2017, it doesn't matter if every year is in a seperate file or if it's one big file/results with all years pooled.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The original Data is named "drg2005_sf", "drg2006_sf" for every year and is in the folder with all the years "sasuser.v94"&lt;BR /&gt;So here is the head of my syntax:&lt;BR /&gt;&lt;BR /&gt;/*** compress files and output alignment ***/&lt;BR /&gt;options nocenter linesize=256 pagesize=90 compress=yes;&lt;BR /&gt;&lt;BR /&gt;/*** macros for paths ***/&lt;BR /&gt;%let datenpfad = ~/sasuser.v94;&lt;BR /&gt;%let outputpfad = ~/sasuser.v94;&lt;BR /&gt;&lt;BR /&gt;/*** Macros for file and output names ***/&lt;BR /&gt;%let datenname = drg;&lt;BR /&gt;%let outputname = drg_out;&lt;BR /&gt;&lt;BR /&gt;/*** Libname assign ***/&lt;BR /&gt;libname daten "&amp;amp;datenpfad";&lt;BR /&gt;&lt;BR /&gt;down below I pick the years I want to use:&lt;BR /&gt;&lt;BR /&gt;%let startjahr = 2005;&lt;BR /&gt;%let endejahr = 2017;&lt;BR /&gt;%do year = &amp;amp;startjahr %to &amp;amp;endejahr;&lt;BR /&gt;&lt;BR /&gt;data drg_&amp;amp;year;&lt;BR /&gt;set daten.&amp;amp;datenname.&amp;amp;year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But if I let it run like this, the Error says:&lt;BR /&gt;ERROR: Datei DATEN.DRG2005.DATA existiert nicht.&lt;BR /&gt;ERROR: Datei DATEN.DRG2006.DATA existiert nicht.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I don't know why it can't find my "drg2005_sf" data or any data of any year, where do I have to make a change?&lt;BR /&gt;I tried to change the "Datenname" but it can't find my data.&lt;BR /&gt;As soon as I delete the &amp;amp;year in the last row it works in any way, maybe for just one year? I don't know, but not the way I want.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope some one can help me, I'm absolute new in sas an statistics at all but I hope I could describe you my problem, if not please text me and I will try to explain it better.&lt;BR /&gt;have a nice day!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600350#M173514</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-10-30T12:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600352#M173515</link>
      <description>&lt;PRE&gt;&amp;amp;datenname.&amp;amp;year&lt;/PRE&gt;
&lt;P&gt;will resolve to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drg2005&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and not your intended name. Use&lt;/P&gt;
&lt;PRE&gt;&amp;amp;datenname.&amp;amp;year._sf&lt;/PRE&gt;
&lt;P&gt;to append the necessary suffix.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600352#M173515</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-30T12:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600356#M173517</link>
      <description>&lt;P&gt;Oh my god thank you so much.&lt;/P&gt;&lt;P&gt;Can I ask you another question?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Down below in my syntax I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = drg;&lt;BR /&gt;title "Output Nr. 1a: Blablabla &amp;amp;year.";&lt;BR /&gt;table XY;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and also&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data = drg n mean std;&lt;BR /&gt;title "Output Nr. 2: Blablabla, &amp;amp;year.";&lt;BR /&gt;var XY;&lt;BR /&gt;where A = 1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is the data = drg right? Because it's the name of my data? Or do I have to add the year? Like, how do it do it that the proc means stuff is for each year?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data = drg or data = drg&amp;amp;2005 or data = drg&amp;amp;2005. or data = drg_&amp;amp;2005&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm so sorry I guess it's really simple but I just don't get it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600356#M173517</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-10-30T12:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600357#M173518</link>
      <description>&lt;P&gt;The dataset after the data= has to exist, so it is up to you to create it, or make sure that it exists already.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600357#M173518</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-30T12:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600370#M173524</link>
      <description>&lt;P&gt;Okay, thanks again.&lt;/P&gt;&lt;P&gt;One last question, I want to do a loop, and also a grouped variable.&lt;/P&gt;&lt;P&gt;So i have ops_ko1 up to ops_ko101, and I want to "loop" it that it's always +1&lt;/P&gt;&lt;P&gt;And I want to say that if ops_ko (no matter which number so ops_ko1-101), if it is = 500 then ops_ko =1, and if ops_ko (no matter which number so ops_ko1-101) ~= 500 then ops_ko = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dumb way:&lt;/P&gt;&lt;P&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko2 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko2 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko3 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko3 = 88398 then ops_ko = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and do it for every ops_ko up to 101&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the smartsolution should be different right?&lt;/P&gt;&lt;P&gt;Anything like..&lt;/P&gt;&lt;P&gt;ops_ko = 0;&lt;BR /&gt;do while (ops_ko&amp;lt;=101);&lt;BR /&gt;ops_ko = ops_ko+1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I don't know how to write it right. Thanks again and have a wonderful day !&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600370#M173524</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-10-30T13:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600371#M173525</link>
      <description>&lt;P&gt;Do you actually have a dataset named DRG? Is it the one you want to use?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your previous code was trying to create a dataset name DRG_&amp;amp;YEAR.&amp;nbsp; Is that they one you want to use?&amp;nbsp; If so then say so in the PROC FREQ code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Trying to use DRG&amp;amp;2005 is not going to work as dataset names cannot have the character &amp;amp; in their names.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600371#M173525</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-30T13:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600379#M173529</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296533"&gt;@hannah_hortlik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Okay, thanks again.&lt;/P&gt;
&lt;P&gt;One last question, I want to do a loop, and also a grouped variable.&lt;/P&gt;
&lt;P&gt;So i have ops_ko1 up to ops_ko101, and I want to "loop" it that it's always +1&lt;/P&gt;
&lt;P&gt;And I want to say that if ops_ko (no matter which number so ops_ko1-101), if it is = 500 then ops_ko =1, and if ops_ko (no matter which number so ops_ko1-101) ~= 500 then ops_ko = 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dumb way:&lt;/P&gt;
&lt;P&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko2 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko2 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko3 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko3 = 88398 then ops_ko = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and do it for every ops_ko up to 101&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the smartsolution should be different right?&lt;/P&gt;
&lt;P&gt;Anything like..&lt;/P&gt;
&lt;P&gt;ops_ko = 0;&lt;BR /&gt;do while (ops_ko&amp;lt;=101);&lt;BR /&gt;ops_ko = ops_ko+1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I don't know how to write it right. Thanks again and have a wonderful day !&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This problem does not need to use macro code.&amp;nbsp; But it could benefit from using an ARRAY.&amp;nbsp; An ARRAY is just a handy way to reference multiple variables using a single name with an index.&amp;nbsp; So to reference your 101 variables you might use an array statement like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array list ops_ko1-ops_ko101 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you reference OPS_KO1 as LIST[1], where the 1 could come from a variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To actually solve your problem you need to explain what you want to do.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to replace the value of OP_KO1 with 0 or 1?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do index=1 to dim(list);
  list[index] = list[index] = 88398&amp;nbsp;;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or do you want to make a new variable with a 0 or 1? If a new variable do you want to make 101 new variables? Or just one.&amp;nbsp; If just one should it be 1 if ANY of the 101 variables have the value and 0 when NONE of the 101 variables have the value? Or something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600379#M173529</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-30T13:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600386#M173533</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to have a grouped variable, is that the right way to say it? The same way like:&lt;/P&gt;&lt;P&gt;age2=0&lt;/P&gt;&lt;P&gt;If age &amp;lt; 10 then age2 = 0&lt;/P&gt;&lt;P&gt;If age &amp;gt;= 10 &amp;amp; age &amp;lt; 20 then age2 = 1&lt;/P&gt;&lt;P&gt;If age &amp;gt;= 20 &amp;amp; age &amp;lt; 30 then age2 = 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ops_ko = 0;&lt;BR /&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko2 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko2 = 88398 then ops_ko = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but now for every ops_ko, up to 101.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I say I want to make a new variable named "ops_ko" which is with all ops_ko1 to ops_ko101. And it should be 1 if ANY of the 101 variables have the value (for example 500) and 0 when NONE of the 101 variables have the value it's a big difference, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And to your last answer:&lt;/P&gt;&lt;P&gt;My actual data is named „drg2005_sf“ , „drg2006_sf“ for every year.&lt;/P&gt;&lt;P&gt;So you mean I have to write „drg_&amp;amp;year“ in this cases if I want results for each year?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = drg;&lt;BR /&gt;title "Output Nr. 1a: Blablabla &amp;amp;year.";&lt;BR /&gt;table XY;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;and also&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data = drg n mean std;&lt;BR /&gt;title "Output Nr. 2: Blablabla, &amp;amp;year.";&lt;BR /&gt;var XY;&lt;BR /&gt;where A = 1;&lt;BR /&gt;run&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600386#M173533</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-10-30T13:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600397#M173541</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296533"&gt;@hannah_hortlik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Okay, thanks again.&lt;/P&gt;
&lt;P&gt;One last question, I want to do a loop, and also a grouped variable.&lt;/P&gt;
&lt;P&gt;So i have ops_ko1 up to ops_ko101, and I want to "loop" it that it's always +1&lt;/P&gt;
&lt;P&gt;And I want to say that if ops_ko (no matter which number so ops_ko1-101), if it is = 500 then ops_ko =1, and if ops_ko (no matter which number so ops_ko1-101) ~= 500 then ops_ko = 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dumb way:&lt;/P&gt;
&lt;P&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko2 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko2 = 88398 then ops_ko = 1;&lt;BR /&gt;if ops_ko3 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko3 = 88398 then ops_ko = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and do it for every ops_ko up to 101&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the smartsolution should be different right?&lt;/P&gt;
&lt;P&gt;Anything like..&lt;/P&gt;
&lt;P&gt;ops_ko = 0;&lt;BR /&gt;do while (ops_ko&amp;lt;=101);&lt;BR /&gt;ops_ko = ops_ko+1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if ops_ko1 ~= 88398 then ops_ko = 0 ;&lt;BR /&gt;if ops_ko1 = 88398 then ops_ko = 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I don't know how to write it right. Thanks again and have a wonderful day !&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you have 101 variables that need to be checked, and just one variable to hold the result. Which&amp;nbsp;&lt;EM&gt;exact&lt;/EM&gt; condition should cause the new variable to be 1, and under which&amp;nbsp;&lt;EM&gt;exact&lt;/EM&gt; condition should it be 0?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600397#M173541</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-30T14:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600407#M173548</link>
      <description>&lt;P&gt;So you have 101 variables that need to be checked, and just one variable to hold the result.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Yes&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which&amp;nbsp;&lt;EM&gt;exact&lt;/EM&gt; condition should cause the new variable to be 1, and under which&amp;nbsp;&lt;EM&gt;exact&lt;/EM&gt; condition should it be 0?&lt;/P&gt;&lt;P&gt;When one of the 101 variables = 500 then it should be 1. If none of the 101 variables = 500 then it should be 0&lt;/P&gt;&lt;P&gt;So if ops_ko1 = 500 then ops_ko (name of the new variable? I don't know) = 1&lt;/P&gt;&lt;P&gt;if ops_ko1 ~= 500 then ops_ko = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this should be for every ops_ko, from ops_ko1 to 101&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:20:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600407#M173548</guid>
      <dc:creator>hannah_hortlik</dc:creator>
      <dc:date>2019-10-30T14:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600409#M173550</link>
      <description>&lt;P&gt;So what you will do is this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;define an array over these 101 variables&lt;/LI&gt;
&lt;LI&gt;set the new variable to zero&lt;/LI&gt;
&lt;LI&gt;iterate through the array, and set the new variable to 1 if the desired value is encountered; you can also add code to exit the loop&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array _ops_ko {101} ops_ko1-ops_ko101;
ops_ko = 0;
do _i = 1 to 101;
  if _ops_ko{_i} = 88398
  then do;
    ops_ko = 1;
    _i = 200; * forces exit of the loop, for performance;
  end;
end;
drop _i;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600409#M173550</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-30T14:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macros and year loop can't find my files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600414#M173551</link>
      <description>&lt;P&gt;Just change the loop.&lt;/P&gt;
&lt;P&gt;I would set the variable to false (0) to start with and then stop looping when it becomes true (1).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ops_ko=0;
do index=1 to dim(list) while (ops_ko=0);
   ops_ko = list[index] = 500 ;
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros-and-year-loop-can-t-find-my-files/m-p/600414#M173551</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-30T14:40:52Z</dc:date>
    </item>
  </channel>
</rss>

