<?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: Macro text manipulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16582#M2323</link>
    <description>thanks very much, work perfect.&lt;BR /&gt;
Regards from Horta, Azores, Very nice Islands..&lt;BR /&gt;
obrigado</description>
    <pubDate>Thu, 09 Apr 2009 12:00:59 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-09T12:00:59Z</dc:date>
    <item>
      <title>Macro text manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16579#M2320</link>
      <description>Hi,&lt;BR /&gt;
I need to combined into a single string the names of variable in a data set to use in a model as predictors, for example data A has variable Name with observations:&lt;BR /&gt;
1 Year 2 Temp 3 Color 4 pH.   I want to create a macro variable string like&lt;BR /&gt;
%let myPredictors = Year Temp Color pH;  so when using a model formula simply type&lt;BR /&gt;
....&lt;BR /&gt;
model myY = &amp;amp;myPredictors / ;    of course I will be working with &amp;gt;50 variables, and possible different ones each time...&lt;BR /&gt;
&lt;BR /&gt;
thanks</description>
      <pubDate>Wed, 08 Apr 2009 16:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16579#M2320</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-08T16:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro text manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16580#M2321</link>
      <description>Explore using SAS PROC SQL and the SAS-maintained view DICTIONARY.COLUMNS -- you can create a SAS macro variable then reference the macro variable that contains your SAS column (dataset variable) names to resolve your variable list/string.&lt;BR /&gt;
&lt;BR /&gt;
Visit the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website and use the SEARCH facility to find conference papers and other SAS-provided documentation and code samples on the search argument "proc sql dictionary columns generate macro variable".&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 08 Apr 2009 16:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16580#M2321</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-08T16:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro text manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16581#M2322</link>
      <description>Hello guys.&lt;BR /&gt;
&lt;BR /&gt;
DICTIONARY.COLUMNS would be the most simple and straightforward way.&lt;BR /&gt;
&lt;BR /&gt;
I still prefer the PROC CONTENTS procedure, since when using it intensively (many columns, many tables) it is a lot more fast against the querying DICTIONARY tables method.&lt;BR /&gt;
&lt;BR /&gt;
I think this will do what you need:&lt;BR /&gt;
&lt;BR /&gt;
proc contents data = A out = _A_CONTENTS noprint;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* only necessary if you need to maintain the column order */&lt;BR /&gt;
proc sort;&lt;BR /&gt;
by VARNUM;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* load NAMEs to myPredictors macro */&lt;BR /&gt;
%let myPredictors=;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set _A_CONTENTS;&lt;BR /&gt;
/* build myPredictors list with NAMES separated by space char */&lt;BR /&gt;
call symput('myPredictors',catx(' ',symget('myPredictors'),NAME));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* result */&lt;BR /&gt;
%put &amp;amp;myPredictors;&lt;BR /&gt;
&lt;BR /&gt;
Greetings from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos at &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Thu, 09 Apr 2009 11:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16581#M2322</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-04-09T11:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro text manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16582#M2323</link>
      <description>thanks very much, work perfect.&lt;BR /&gt;
Regards from Horta, Azores, Very nice Islands..&lt;BR /&gt;
obrigado</description>
      <pubDate>Thu, 09 Apr 2009 12:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-text-manipulation/m-p/16582#M2323</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-09T12:00:59Z</dc:date>
    </item>
  </channel>
</rss>

