<?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: do loop for making footnote in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920328#M362467</link>
    <description>&lt;P&gt;you could do it like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set fnt;
  do fnt = fnt_1, fnt_2, fnt_3, fnt_4;
   i+1;
   call execute( cat( cats("footnote",i), " j = l ", fnt, " ;")) ;
  end ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I wouldn't call it "good programming practice"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array in SAS, in it's fundamental version, is just a way to loop over multiple variables conveniently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2024 17:40:49 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2024-03-14T17:40:49Z</dc:date>
    <item>
      <title>do loop for making footnote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920317#M362463</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a file for footnotes, like below:&lt;/P&gt;
&lt;PRE&gt;data fnt;
length fnt_1 $80   fnt_2 $80  fnt_3  $80  fnt_4  $80;
 infile datalines dlm=',' ;
 input fnt_1    fnt_2   fnt_3    fnt_4 ;
 datalines;
"Teach us the most important lessons in life", "Give the best advice and know the right thing to say." ,"Given us two of the best things we could ever have: life and love.", "Loved us unconditionally"
;
run;&lt;/PRE&gt;
&lt;P&gt;I would like to use do loop to write my footnotes. I had my codes as:&lt;/P&gt;
&lt;PRE&gt;data _null_;
set fnt;

  do i=1 to 4.;
       call execute( cat( "footnote"
                                    , i
                                     , " j = l "
                                                 ,  fnt_i
                                        
                                    , " ;"
                                    )
                                ) ;
         	end ;
run;&lt;/PRE&gt;
&lt;P&gt;However I got errors as below. 1-4 were added to footnote, but I could not get the value of fnt_1 to fnt_4 out.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stataq_0-1710435339550.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94629iEF512D2493E49670/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stataq_0-1710435339550.png" alt="stataq_0-1710435339550.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Could anyone guide me on this?&amp;nbsp; Ideal outcome is I can generate the line as:&lt;/P&gt;
&lt;PRE&gt;footnote1 j=l&amp;nbsp;"Teach us the most important lessons in life";
footnote2 j=l&amp;nbsp;"Give the best advice and know the right thing to say.";&lt;/PRE&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 17:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920317#M362463</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-03-14T17:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: do loop for making footnote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920318#M362464</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set fnt;
  array fnt[*] fnt_:;
  do i=1 to 4;
   call execute( cat( cats("footnote",i), " j = l ", fnt[i], " ;")) ;
   end ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Mar 2024 17:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920318#M362464</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-03-14T17:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: do loop for making footnote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920322#M362465</link>
      <description>&lt;P&gt;thanks so much!&lt;/P&gt;
&lt;P&gt;I am new to sas.&amp;nbsp; Please pardon me if my question is too silly : Do we have to do array? Is it possible to directly use value from fnt.fnt_1 to fnt_4?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 17:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920322#M362465</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-03-14T17:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: do loop for making footnote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920325#M362466</link>
      <description>&lt;P&gt;Sure.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want FNT_1 then just type that string into you program instead.&amp;nbsp; Get it to work to generate one footnote from one variable.&amp;nbsp; Then replicate the line and change the 1's to 2's.&amp;nbsp; Repeat.&amp;nbsp; That is called WALLPAPER code since it has a repeating pattern like a wallpaper pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the ARRAY statement allows you to reference variables by an index so that it is possible to loop over the index.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 17:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920325#M362466</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-14T17:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: do loop for making footnote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920328#M362467</link>
      <description>&lt;P&gt;you could do it like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set fnt;
  do fnt = fnt_1, fnt_2, fnt_3, fnt_4;
   i+1;
   call execute( cat( cats("footnote",i), " j = l ", fnt, " ;")) ;
  end ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I wouldn't call it "good programming practice"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array in SAS, in it's fundamental version, is just a way to loop over multiple variables conveniently.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 17:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-for-making-footnote/m-p/920328#M362467</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-03-14T17:40:49Z</dc:date>
    </item>
  </channel>
</rss>

