<?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: Creating macro variable for a set of attributes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431839#M106860</link>
    <description>&lt;P&gt;Its not quite clear how many macro variables you're trying to create.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you SQL doesn't support variable lists or arrays this is likely much easier in a data step using CALL SYMPUTX&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If you can clarify what you're trying to do we can help you with sample code.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jan 2018 16:28:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-01-29T16:28:05Z</dc:date>
    <item>
      <title>Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431834#M106859</link>
      <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for some suggestions on creating the macro variable for 15 variables of the total 400 variable table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my thinking , but if there is a better way, please suggest me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; select lowcase(name) into :tnames separated by ','&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; from sashelp.vcolumn&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; where libname = 'WORK'&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; and upcase(memname) = "CLMS"&amp;nbsp;&amp;nbsp; ---&amp;nbsp; CLMS is the table has 400 attributes&lt;BR /&gt;&amp;nbsp; order by lowcase(name)&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;quit;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the fields that are needed to be converted to macro are -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Proc Sql Noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select func_1 func_2 func_3 func4 ..............................func15&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Into:func_1 func_2 func_3 func4 ..............................func15&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From CLMS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431834#M106859</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2018-01-29T16:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431839#M106860</link>
      <description>&lt;P&gt;Its not quite clear how many macro variables you're trying to create.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you SQL doesn't support variable lists or arrays this is likely much easier in a data step using CALL SYMPUTX&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If you can clarify what you're trying to do we can help you with sample code.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431839#M106860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-29T16:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431842#M106863</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;suggestions on creating the macro variable for 15 variables of the total 400 variable table" - I would suggest to remodel your data.&amp;nbsp; 400 variables is a lot, and starting to push processing into macro is only going to make your code far more overcomplicated, and less robust.&amp;nbsp; This is something seen here a lot, and generally comes from an Excel way of thinking.&amp;nbsp; You can work with small clumps of variables simply by using an array.&amp;nbsp; However a far more robust, simple to code, and easier to read/maintain method is to normalise your data, so rather than have 400 variables, have 10 or 20 id variables, then have a paramter/response setup, e.g.:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ID1&amp;nbsp; ID2&amp;nbsp; &amp;nbsp;Q1&amp;nbsp; &amp;nbsp;Q2&amp;nbsp; &amp;nbsp;Q3&amp;nbsp; Q4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;abc&amp;nbsp; def&amp;nbsp; &amp;nbsp;ghi&amp;nbsp; rty&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I remodel this as:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ID1&amp;nbsp; ID2&amp;nbsp; Q&amp;nbsp; &amp;nbsp;RESPONSE:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;Q1 abc&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;Q2&amp;nbsp; def&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;Q3&amp;nbsp; ghi&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There are many reason why this is a better model, first off the number of variables you have to work with (essentially hardcode in your program) is minimal, the data can expand without re-coding.&amp;nbsp; Second you can still do processing on a select number of data points, by simply using a where Q="Q2" for instance, far simpler than macro lists, and loops trying to do the same.&amp;nbsp; You will also find your data tends to be smaller on the disc as only the necessary information is kept (whereas as large oblong of data will generally hold lots of missing data).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431842#M106863</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-29T16:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431847#M106865</link>
      <description>&lt;P&gt;Agree with Reeza.&amp;nbsp; If you show 5 records from your CLMS dataset, and then describe the output you would want (creation of a bunch of macro variables?), that would help.&amp;nbsp; You don't&amp;nbsp; need to show real data, just a few variables (func_1-func_3) and a few records should be enough.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431847#M106865</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-01-29T16:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431854#M106868</link>
      <description>&lt;P&gt;Your code is almost there, but the syntax for the INTO clause is a little different from the SELECT clause.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select name
       , ':'||name
    into :varnames separated by ','
       , :mvarnames separated by ' trimmed ,'
  from sashelp.vcolumn
  where libname = 'WORK'
    and upcase(memname) = "CLMS"
  ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So now you can use the macro variables to generate your SQL statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  select &amp;amp;varnames into &amp;amp;mvarnames from CLMS;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431854#M106868</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-29T16:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431855#M106869</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CLMS is the oracle table that has 400 attributes. Data will be something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;attributes - &amp;gt; test1&amp;nbsp;&amp;nbsp;&amp;nbsp; test2&amp;nbsp;&amp;nbsp; test3&amp;nbsp;&amp;nbsp; test4&amp;nbsp; ....................................................func1&amp;nbsp; func2 func3 ........func15 ................................test400&lt;/P&gt;&lt;P&gt;data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;gt; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----------------------------------------&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -----&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ------------------------&amp;nbsp;&amp;nbsp; d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;func1 to func15 are the numeric attributes that has 1 or 0 values.&amp;nbsp; I need to calculate the sum by line level in my code. So i was trying create macro variable and use sum function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431855#M106869</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2018-01-29T16:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431857#M106871</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86567"&gt;@SASAna&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CLMS is the oracle table that has 400 attributes. Data will be something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;attributes - &amp;gt; test1&amp;nbsp;&amp;nbsp;&amp;nbsp; test2&amp;nbsp;&amp;nbsp; test3&amp;nbsp;&amp;nbsp; test4&amp;nbsp; ....................................................func1&amp;nbsp; func2 func3 ........func15 ................................test400&lt;/P&gt;
&lt;P&gt;data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;gt; a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----------------------------------------&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -----&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ------------------------&amp;nbsp;&amp;nbsp; d&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;func1 to func15 are the numeric attributes that has 1 or 0 values.&amp;nbsp; I need to calculate the sum by line level in my code. So i was trying create macro variable and use sum function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Ana&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To get sums just use PROC SUMMARY.&amp;nbsp; You didn't say what your id variables are but let's just assume they are LINE and LEVEL.&amp;nbsp; You could a BY statement if your data is sorted (or indexed in Oracle).&amp;nbsp; You can list the variables you want in the VAR statement. Or you could use SQL code to select a space delimited list of variable names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=oralib.tablename nway ;
  class line level ;
  var func1-func15 ;
  output out=want sum= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431857#M106871</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-29T16:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431858#M106872</link>
      <description>&lt;P&gt;You don't need a list of variables for the SUM function. It will accept a variable list, so you can do something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;mysum=sum(of func1-func15) ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431858#M106872</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-01-29T16:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431859#M106873</link>
      <description>&lt;P&gt;Not clear why you need macro variables, your post didn't come across clearly, can you please reformat that so it's legible, I can't follow it &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The logic doesn't make sense though, the sum by line is easily done using the sum function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x=sum(of func1-func15);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/431859#M106873</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-29T16:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/432046#M106934</link>
      <description>&lt;P&gt;Thanks for the answers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attributes are in different names to put them in var part of the proc summary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, i was thinking to create them as Macro variables and use it with summary function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Ana.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 03:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/432046#M106934</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2018-01-30T03:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating macro variable for a set of attributes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/432047#M106935</link>
      <description>&lt;P&gt;So is this a metadata table of sorts, that lists the variables and you're trying to extract variable names from it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's perfectly valid approach, my only suggestion would be to transpose the data so you could use SQL to create the macro variables instead, for example this creates a macro variable of the list of numeric variables in the CARS data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name into :var_list separated by " "
from sashelp.vcolumn
where libname='SASHELP' and memname='CARS' and type='N';
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(You could just use _numeric_ instead though).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=sashelp.cars;
var _numeric_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jan 2018 03:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-macro-variable-for-a-set-of-attributes/m-p/432047#M106935</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-30T03:35:16Z</dc:date>
    </item>
  </channel>
</rss>

