<?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: How to create a list that will be iterated in the future in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713175#M219971</link>
    <description>&lt;P&gt;I implemented from document syntax, so how i can from logs to one variable.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1                                                            System SAS                             19:33 Thursday, January 21, 2021

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Test_from book';
4          %LET _CLIENTPROCESSFLOWNAME='Przebieg procesu';
5          %LET _CLIENTPROJECTPATH='D:\Education\Big Data\Wyklady\1 semestr\Sas\Praca zaliczeniowa\3 zadanie\Projekt_sas.egp';
6          %LET _CLIENTPROJECTPATHHOST='MSI';
7          %LET _CLIENTPROJECTNAME='Projekt_sas.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=ACTIVEX;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=EGDefault
17             STYLESHEET=(URL="file:///D:/Education/Big%20Data/SAS/Sas%20soft/SASEnterpriseGuide/7.1/Styles/EGDefault.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&amp;amp;sasworklocation
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
26         %macro varlist(dataset=);
27         proc contents data=&amp;amp;dataset out=cont noprint;
28         run;
29         proc sql noprint;
30         select distinct name into :varname1-:varname999 from cont;
31         quit;
32         %do i= 1 %to &amp;amp;sqlobs;
33         %put &amp;amp;i &amp;amp;&amp;amp;varname&amp;amp;i;
34         %end;
35         %mend varlist;
36         %varlist(dataset=sashelp.cars);

NOTE: The data set WORK.CONT has 15 observations and 41 variables.
NOTE: PROCEDURE CONTENTS used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1 Cylinders
2 DriveTrain
3 EngineSize
4 Horsepower
5 Invoice
6 Length
7 MPG_City
8 MPG_Highway
9 MSRP
2                                                            System SAS                             19:33 Thursday, January 21, 2021

10 Make
11 Model
12 Origin
13 Type
14 Weight
15 Wheelbase
37         
38         GOPTIONS NOACCESSIBLE;
39         %LET _CLIENTTASKLABEL=;
40         %LET _CLIENTPROCESSFLOWNAME=;
41         %LET _CLIENTPROJECTPATH=;
42         %LET _CLIENTPROJECTPATHHOST=;
43         %LET _CLIENTPROJECTNAME=;
44         %LET _SASPROGRAMFILE=;
45         %LET _SASPROGRAMFILEHOST=;
46         
47         ;*';*";*/;quit;run;
48         ODS _ALL_ CLOSE;
49         
50         
51         QUIT; RUN;
52         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To next form:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let list_of_variables =&amp;nbsp;Cylinders&amp;nbsp;DriveTrain&amp;nbsp;EngineSize&amp;nbsp;Horsepower&amp;nbsp;Invoice&amp;nbsp;Length&amp;nbsp;MPG_City&amp;nbsp;MPG_Highway&amp;nbsp;MSRP&amp;nbsp;Make&amp;nbsp;Model&amp;nbsp;Origin&amp;nbsp;Type&amp;nbsp;Weight&amp;nbsp;Wheelbase;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 Jan 2021 18:51:51 GMT</pubDate>
    <dc:creator>x3d1m4</dc:creator>
    <dc:date>2021-01-21T18:51:51Z</dc:date>
    <item>
      <title>How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713145#M219956</link>
      <description>&lt;P&gt;Hi. Is there any good method for creating a list of numeric variables? Below I put some sample code to show what I want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data my_dataset;
set sashelp.cars;
run;
proc contents data=my_loop noprint out=names_info (keep= type name varnum) ;
run;
proc sort data = names_info out = variable_names(keep = name);
     by varnum; where type=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to create the int list variables. I need use them in future to loop through list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let my_work_variables = Cylinders EngineSize Horsepower Invoice Length MPG_City MPG_Highway MSRP Weight Wheelbase;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for hint, solution : )&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713145#M219956</guid>
      <dc:creator>x3d1m4</dc:creator>
      <dc:date>2021-01-21T17:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713151#M219960</link>
      <description>This is great reference, with your exact problem.&lt;BR /&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings17/1516-2017.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings17/1516-2017.pdf&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713151#M219960</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-21T18:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713171#M219969</link>
      <description>Example 5: Place All SAS Data Set Variables into a Macro Variable&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=n0na9f3e0qxdazn1lh6o7s919lrq.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=n0na9f3e0qxdazn1lh6o7s919lrq.htm&amp;amp;locale=en&lt;/A&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713171#M219969</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-21T18:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713173#M219970</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/364476"&gt;@x3d1m4&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also retrieve such a list from &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=sqlproc&amp;amp;docsetTarget=n02s19q65mw08gn140bwfdh7spx7.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;DICTIONARY.COLUMNS&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name into :my_work_variables separated by ' '
from dictionary.columns
where libname='WORK' &amp;amp; memname='MY_DATASET' &amp;amp; type='num'
order by name;
quit;

%put &amp;amp;=my_work_variables;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It would be easy to modify this PROC SQL step so as to produce, e.g., a comma-separated list of quoted names of variables satisfying additional criteria regarding their names, lengths, labels, formats, etc. in a very specific sort order.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713173#M219970</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-21T18:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713175#M219971</link>
      <description>&lt;P&gt;I implemented from document syntax, so how i can from logs to one variable.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1                                                            System SAS                             19:33 Thursday, January 21, 2021

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Test_from book';
4          %LET _CLIENTPROCESSFLOWNAME='Przebieg procesu';
5          %LET _CLIENTPROJECTPATH='D:\Education\Big Data\Wyklady\1 semestr\Sas\Praca zaliczeniowa\3 zadanie\Projekt_sas.egp';
6          %LET _CLIENTPROJECTPATHHOST='MSI';
7          %LET _CLIENTPROJECTNAME='Projekt_sas.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=ACTIVEX;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=EGDefault
17             STYLESHEET=(URL="file:///D:/Education/Big%20Data/SAS/Sas%20soft/SASEnterpriseGuide/7.1/Styles/EGDefault.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&amp;amp;sasworklocation
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
26         %macro varlist(dataset=);
27         proc contents data=&amp;amp;dataset out=cont noprint;
28         run;
29         proc sql noprint;
30         select distinct name into :varname1-:varname999 from cont;
31         quit;
32         %do i= 1 %to &amp;amp;sqlobs;
33         %put &amp;amp;i &amp;amp;&amp;amp;varname&amp;amp;i;
34         %end;
35         %mend varlist;
36         %varlist(dataset=sashelp.cars);

NOTE: The data set WORK.CONT has 15 observations and 41 variables.
NOTE: PROCEDURE CONTENTS used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1 Cylinders
2 DriveTrain
3 EngineSize
4 Horsepower
5 Invoice
6 Length
7 MPG_City
8 MPG_Highway
9 MSRP
2                                                            System SAS                             19:33 Thursday, January 21, 2021

10 Make
11 Model
12 Origin
13 Type
14 Weight
15 Wheelbase
37         
38         GOPTIONS NOACCESSIBLE;
39         %LET _CLIENTTASKLABEL=;
40         %LET _CLIENTPROCESSFLOWNAME=;
41         %LET _CLIENTPROJECTPATH=;
42         %LET _CLIENTPROJECTPATHHOST=;
43         %LET _CLIENTPROJECTNAME=;
44         %LET _SASPROGRAMFILE=;
45         %LET _SASPROGRAMFILEHOST=;
46         
47         ;*';*";*/;quit;run;
48         ODS _ALL_ CLOSE;
49         
50         
51         QUIT; RUN;
52         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To next form:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let list_of_variables =&amp;nbsp;Cylinders&amp;nbsp;DriveTrain&amp;nbsp;EngineSize&amp;nbsp;Horsepower&amp;nbsp;Invoice&amp;nbsp;Length&amp;nbsp;MPG_City&amp;nbsp;MPG_Highway&amp;nbsp;MSRP&amp;nbsp;Make&amp;nbsp;Model&amp;nbsp;Origin&amp;nbsp;Type&amp;nbsp;Weight&amp;nbsp;Wheelbase;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713175#M219971</guid>
      <dc:creator>x3d1m4</dc:creator>
      <dc:date>2021-01-21T18:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713177#M219972</link>
      <description>That creates a macro variable for every variable name, not a single macro variable list. &lt;BR /&gt;&lt;BR /&gt;Either of the latter links posted by myself or FreelanceReinhard will generate what you want.&lt;BR /&gt;&lt;BR /&gt;Or change the following part of your code:&lt;BR /&gt; proc sql noprint;&lt;BR /&gt;30         select distinct name into :varname1-:varname999 from cont;&lt;BR /&gt;31         quit;&lt;BR /&gt;&lt;BR /&gt;to &lt;BR /&gt; proc sql noprint;&lt;BR /&gt;         select distinct name into :varList separated by " " from cont;&lt;BR /&gt;         quit;&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;varList.;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note that reading from dictionary tables is definitely simpler code, but if you have big libraries it can also be time &amp;amp; resource intensive.</description>
      <pubDate>Thu, 21 Jan 2021 18:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713177#M219972</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-21T18:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713188#M219978</link>
      <description>&lt;P&gt;If the list is short enough you can use one macro variable with a delimiter.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select distinct name into :varnames separated by '|' from cont;
%let nvars=&amp;amp;sqlobs;
...
%do index=1 %to &amp;amp;nvars;
   %let varname = %scan(&amp;amp;varnames,&amp;amp;index,|);
   ...
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Generating multiple macro variables usually just makes the problem harder, but there is a 64K byte limit on the size of a single macro variable.&amp;nbsp; In that case instead of making multiple macro variables it might be easier to just leave the values in a dataset and use a data step to drive the looping.&amp;nbsp; For example by using CALL EXECUTE().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table varnames as select distinct name from cont ;
...
data _null_;
  set varnames ;
  call execute(cats('%nrstr(%mymacro)(name=',name,')'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 19:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713188#M219978</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-21T19:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713189#M219979</link>
      <description>&lt;P&gt;I change the code to next code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro varList(dataset=);
proc contents data=&amp;amp;dataset out=cont noprint;
run;
proc sql noprint;
select distinct name into :varList separated by " " from cont;
quit;
%put &amp;amp;varList;
%mend;
%varList(dataset=sashelp.cars);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But excample and excample_1 not the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let excample= &amp;amp;varList;
%let excample_1 =cylinders horsepower;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think i do for sure something wrong. Regard of my experience i cannot detect what is going on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 19:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713189#M219979</guid>
      <dc:creator>x3d1m4</dc:creator>
      <dc:date>2021-01-21T19:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713192#M219980</link>
      <description>&lt;P&gt;If the target macro variable, VARLIST, does not exist then by default it will be created as LOCAL to the macro, %varlist, and will disappear when the macro finishes.&lt;/P&gt;
&lt;P&gt;So either define the macro variable in advance:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let varlist= ;
%varList(dataset=sashelp.cars);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or modify your code to make the macro variable GLOBAL if it does not already exist.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro varList(dataset=);
%if not %symexist(varlist) %then %global varlist;
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 19:34:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713192#M219980</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-21T19:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713222#M219990</link>
      <description>&lt;P&gt;I know what i miss.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;%let varList=;&lt;/STRONG&gt;&lt;/FONT&gt;
%macro varList(dataset=);
proc contents data=&amp;amp;dataset out=cont noprint;
run;
proc sql noprint;
select distinct name into :varList separated by " " from cont;
quit;
%do i= 1 %to &amp;amp;sqlobs;
%put &amp;amp;varList;
%end;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If the target macro variable, VARLIST, does not exist then by default it will be created as LOCAL to the macro, %varlist, and will disappear when the macro finishes.&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 21:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713222#M219990</guid>
      <dc:creator>x3d1m4</dc:creator>
      <dc:date>2021-01-21T21:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a list that will be iterated in the future</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713224#M219991</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;That creates a macro variable for every variable name, not a single macro variable list.&lt;BR /&gt;&lt;BR /&gt;Either of the latter links posted by myself or FreelanceReinhard will generate what you want.&lt;BR /&gt;&lt;BR /&gt;Or change the following part of your code:&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;30 select distinct name into :varname1-:varname999 from cont;&lt;BR /&gt;31 quit;&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select distinct name into :varList separated by " " from cont;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;varList.;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note that reading from dictionary tables is definitely simpler code, but if you have big libraries it can also be time &amp;amp; resource intensive.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Thank You for guiding&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 21:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-list-that-will-be-iterated-in-the-future/m-p/713224#M219991</guid>
      <dc:creator>x3d1m4</dc:creator>
      <dc:date>2021-01-21T21:16:19Z</dc:date>
    </item>
  </channel>
</rss>

