<?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: %SysFunc &amp;amp; TranWrd in a %Macro-step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232030#M42277</link>
    <description>&lt;P&gt;I think I can make my question a bit shorter.&amp;nbsp;The goal is to get the "AFD GDC GEX" into a row in a dataset beginning with "Outarray " and ending with ";" - within a %macro-step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is, I start out with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Have;&lt;BR /&gt;&amp;nbsp; Input Var_List_TD $ @@;&lt;BR /&gt;&amp;nbsp; Datalines;&lt;BR /&gt;AFD GDC GEX&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;****&lt;/P&gt;&lt;P&gt;The goal is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cmd="Outarray AFD GDC GEX"; Output; * &amp;lt;-- but&amp;nbsp;not this way, but dynamic &amp;amp; within a %macro statement;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(?)&lt;/P&gt;</description>
    <pubDate>Wed, 28 Oct 2015 15:20:05 GMT</pubDate>
    <dc:creator>user24feb</dc:creator>
    <dc:date>2015-10-28T15:20:05Z</dc:date>
    <item>
      <title>%SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232023#M42272</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I must modify the following %Sysfunc-TranWrd-Code to work in a %Macro-step. Dataset "Cmd" works, dataset "Cmd2" is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data A;&lt;BR /&gt;&amp;nbsp; Input Var_List_TD $ @@;&lt;BR /&gt;&amp;nbsp; Datalines;&lt;BR /&gt;AFD GDC GEX&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc SQL NoPrint;&lt;BR /&gt;&amp;nbsp; Select Var_List_TD Into :Var_List_TD Separated By ' ' From A;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;%Put **&amp;amp;Var_List_TD.**;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Cmd; * &amp;lt;-- works;&lt;BR /&gt;&amp;nbsp; Length Cmd $200.;&lt;BR /&gt;&amp;nbsp; Cmd=Cat("&amp;nbsp; OutArray ","x%Sysfunc(TranWrd(&amp;amp;Var_List_TD.,%Str( ),%Str(", "x)))",";"); Output;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Macro Macro_Cmd; * &amp;lt;-- does not work;&lt;BR /&gt;Data Cmd2;&lt;BR /&gt;&amp;nbsp; Length Cmd $200.;&lt;BR /&gt;&amp;nbsp; Cmd=Cat("&amp;nbsp; OutArray ","x%Sysfunc(TranWrd(&amp;amp;Var_List_TD.,%Str( ),%Str(", "x)))",";"); Output;&lt;BR /&gt;Run;&lt;BR /&gt;%Mend;&lt;BR /&gt;%Macro_Cmd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Let dummy="x%Sysfunc(TranWrd(&amp;amp;Var_List_TD.,%Str( ),%Str(", "x)))";&lt;BR /&gt;%Put *&amp;amp;dummy.**;&lt;BR /&gt;%Macro Macro_Cmd; * &amp;lt;-- this what I am trying to avoid;&lt;BR /&gt;Data Cmd3;&lt;BR /&gt;&amp;nbsp; Length Cmd $200.;&lt;BR /&gt;&amp;nbsp; Cmd=Cat("&amp;nbsp; OutArray ",&amp;amp;dummy.,";"); Output;&lt;BR /&gt;Run;&lt;BR /&gt;%Mend;&lt;BR /&gt;%Macro_Cmd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;amp;kind regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 14:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232023#M42272</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-10-28T14:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232026#M42273</link>
      <description>&lt;P&gt;Sorry, not even going to try on that. &amp;nbsp;What is it your trying to do, I can pretty much guarentee that the moment code looks like % &amp;amp;&amp;amp; % xyz there is a far better way of doing things.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 15:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232026#M42273</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-28T15:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232030#M42277</link>
      <description>&lt;P&gt;I think I can make my question a bit shorter.&amp;nbsp;The goal is to get the "AFD GDC GEX" into a row in a dataset beginning with "Outarray " and ending with ";" - within a %macro-step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is, I start out with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Have;&lt;BR /&gt;&amp;nbsp; Input Var_List_TD $ @@;&lt;BR /&gt;&amp;nbsp; Datalines;&lt;BR /&gt;AFD GDC GEX&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;****&lt;/P&gt;&lt;P&gt;The goal is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cmd="Outarray AFD GDC GEX"; Output; * &amp;lt;-- but&amp;nbsp;not this way, but dynamic &amp;amp; within a %macro statement;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(?)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 15:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232030#M42277</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-10-28T15:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232031#M42278</link>
      <description>&lt;P&gt;I have to agree.&amp;nbsp; This looks like an exercise in complicating a simple task, and adding macro language to preserve job security.&amp;nbsp; Start here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data A;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;BR /&gt;&amp;nbsp; Input Var_List_TD $200.;&lt;BR /&gt;&amp;nbsp; Datalines;&lt;BR /&gt;AFD GDC GEX&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then add a few lines after the INPUT statement to construct the string you want.&amp;nbsp; No macro language needed, but you do need to understand what the output is supposed to look like.&amp;nbsp; A DATA step can apply character functions much more easily than macro language.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 15:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232031#M42278</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-28T15:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232035#M42279</link>
      <description>&lt;P&gt;I am afraid adding up the rows won't suffice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But my first question was way&amp;nbsp;too complicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to achieve is, to get this within a %Macro and %Mend:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Let Var_List_TD=AFD GDC GEX;&lt;/P&gt;&lt;P&gt;Data Cmd;&lt;BR /&gt;&amp;nbsp; Length Cmd $200.;&lt;BR /&gt;&amp;nbsp; Cmd=Cat("&amp;nbsp; OutArray ","%Sysfunc(TranWrd(&amp;amp;Var_List_TD.,%Str( ),%Str( ", ")))",";"); Output;&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, 28 Oct 2015 15:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232035#M42279</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-10-28T15:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232039#M42280</link>
      <description>&lt;P&gt;Something like this, if your example is more complicated, then post accurate example data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
  Input Var_List_TD $ @@;
  Datalines;
AFD GDC GEX
;
Run;

data tmp;/*_null_;*/
  set have end=last;
  retain sp;
  length sp $2000;
  if _n_=1 then sp=strip(var_list_td);
  else sp=cat(strip(sp)," ",strip(var_list_td));
  if last then call symput('LIST',cats('Out array ',strip(sp));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Oct 2015 15:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232039#M42280</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-28T15:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232046#M42282</link>
      <description>&lt;P&gt;OK, if it must be a macro ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro must (varlist=);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cmd="Outarray &amp;amp;varlist";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;%mend must;&lt;/P&gt;
&lt;P&gt;%must (varlist=AFD GDC GEX)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 16:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232046#M42282</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-28T16:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232167#M42300</link>
      <description>I recognize I have got to simplify this. I did not see this at first. Sorry.</description>
      <pubDate>Thu, 29 Oct 2015 06:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232167#M42300</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-10-29T06:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: %SysFunc &amp; TranWrd in a %Macro-step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232171#M42302</link>
      <description>&lt;P&gt;Yes, back in the day V6 and before, functionality was a bit more limited, therefore macro was used a lot to get round things. &amp;nbsp;Nowadays though, if find I look at 95% of macro code and see it is not worth it, simple datasteps and straightforward coding can do most of it. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 08:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SysFunc-amp-TranWrd-in-a-Macro-step/m-p/232171#M42302</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-29T08:48:25Z</dc:date>
    </item>
  </channel>
</rss>

