<?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: Common SAS issue with lists in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408915#M99867</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169765"&gt;@sasnewbie12&lt;/a&gt;, what kind of file contains that list ? Can you save it as a csv file ?&lt;/P&gt;
&lt;P&gt;If positive then you can addapt next code to your needs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mylist '...path_and_name.csv';
data temp;
    infile mylist dlm=',' truncover;
    input var_in &amp;lt;informat.&amp;gt;;
run;

filename list4 '...path_and_name.sas';
data _null_;
  set temp;
        retain var1-var4;  /* addapt to nomber of columns */
        array varx $ var1-var4;   /* assumed 4 columns */
        i = mod(_N_ - 1,4) +1;     /* assumed 4 columns */
        varx(i) = var_in;
        file list4;
        line = catx(' ',var1,var2,var3,var4);
        if i=4   then put line;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then you can use %INCLUDE LIST4; later in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If some of the variables are numeric and other character type then you may need add format/informat info to the list and to the output file.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Oct 2017 21:39:57 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2017-10-30T21:39:57Z</dc:date>
    <item>
      <title>Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408833#M99848</link>
      <description>&lt;P&gt;I have a long list of variables up to 5000. I want to include these in a sas proc. However, how can I paste these from word or excel into sas without having a long linear list where i have to scroll down for a long time to see. I would like to have it spread out over multiple&amp;nbsp;rows&amp;nbsp;(without having to manually go in and rearrange it).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other words, I want to make this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;into this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;5 6 7 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so it can be easier to manage.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 18:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408833#M99848</guid>
      <dc:creator>sasnewbie12</dc:creator>
      <dc:date>2017-10-30T18:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408844#M99855</link>
      <description>&lt;P&gt;If the variables are numbered sequentially (are they?) then you could use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;x1-x5000&lt;/PRE&gt;
&lt;P&gt;If they are not numbered sequentially, then you could use the syntax of the format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;first -- last&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Oct 2017 18:52:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408844#M99855</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-10-30T18:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408854#M99858</link>
      <description>&lt;P&gt;I personally wouldn't work with either of those approaches. Load your data into a text or Excel file and import them directly into your process.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 19:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408854#M99858</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-30T19:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408861#M99859</link>
      <description>&lt;P&gt;You can use the TF line command (text flow) in the program editor (not the "enhanced" editor, but the original editor that allows you to type command letters into the line number area).&amp;nbsp; But since they have broken it lately you will need to paste them into the bottom of the program to prevent it from re flowing the whole program.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 149px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16318i1708DB324118B8D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16320iFE54520EDB020E08/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could just read them in and write them back to log where you could copy and paste them again.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 length name $32 ;
 input name @@ ;
 file log column=cc ;
 if cc &amp;gt; 60 then putlog ;
 putlog name @ ;
cards;
    name
    sex
    age
    height
    weight
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 19:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408861#M99859</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-30T19:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408878#M99860</link>
      <description>&lt;P&gt;Keep in mind that the limit for the textual size of a SAS statement is 32767, so handling that many variables might prove impossible.&lt;/P&gt;
&lt;P&gt;Rethink your data structure.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 19:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408878#M99860</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-30T19:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408883#M99861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Keep in mind that the limit for the textual size of a SAS statement is 32767, so handling that many variables might prove impossible.&lt;/P&gt;
&lt;P&gt;Rethink your data structure.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That statement is not true. Variables are limited to 32,767. Macro variables are twice that. Statement as far as I know have no limit.&lt;/P&gt;
&lt;P&gt;Try running this code that will create a LABEL statement that is more can 64K characters long.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;

data _null_;
 length name $32 label $256 ;
 file code lrecl=300 ;
 put 'label';
 do i=1 to 300 ;
   name = cats('VAR',i);
   label = 'label for ' || name ;
   put '  ' name $32. '="' label $256. '"' ;
 end;
 put ';' ;
run;

data test;
 array xx var1-var300 ;
 %include code ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Oct 2017 19:45:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408883#M99861</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-30T19:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408892#M99862</link>
      <description>&lt;P&gt;Thanks for your inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to clarify, the variable names are unrelated and not in any kind of order. I know that we can do this with a macro or code; is there any way to do this quickly, I find myself coming across this issue frequently; if it's not 5000, I still may have a hundred variables and it doesn't look clean to have a long linear list within my code syntax.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 20:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408892#M99862</guid>
      <dc:creator>sasnewbie12</dc:creator>
      <dc:date>2017-10-30T20:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408893#M99863</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169765"&gt;@sasnewbie12&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to clarify, the variable names are unrelated and not in any kind of order. I know that we can do this with a macro or code; is there any way to do this quickly, I find myself coming across this issue frequently; if it's not 5000, I still may have a hundred variables and it doesn't look clean to have a long linear list within my code syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have the list in a dataset then it is easy to generate the list into a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint ;
select name into :varlist separated by ' '
from varlist
;
quit;

proc print data=have ;
  var &amp;amp;varlist;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Oct 2017 20:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408893#M99863</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-30T20:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408912#M99866</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;KurtBremser wrote:
&lt;P&gt;Rethink your data structure.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think this is wise advice.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 21:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408912#M99866</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-10-30T21:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408915#M99867</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169765"&gt;@sasnewbie12&lt;/a&gt;, what kind of file contains that list ? Can you save it as a csv file ?&lt;/P&gt;
&lt;P&gt;If positive then you can addapt next code to your needs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename mylist '...path_and_name.csv';
data temp;
    infile mylist dlm=',' truncover;
    input var_in &amp;lt;informat.&amp;gt;;
run;

filename list4 '...path_and_name.sas';
data _null_;
  set temp;
        retain var1-var4;  /* addapt to nomber of columns */
        array varx $ var1-var4;   /* assumed 4 columns */
        i = mod(_N_ - 1,4) +1;     /* assumed 4 columns */
        varx(i) = var_in;
        file list4;
        line = catx(' ',var1,var2,var3,var4);
        if i=4   then put line;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then you can use %INCLUDE LIST4; later in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If some of the variables are numeric and other character type then you may need add format/informat info to the list and to the output file.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 21:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/408915#M99867</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-10-30T21:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Common SAS issue with lists</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/409005#M99901</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Keep in mind that the limit for the textual size of a SAS statement is 32767, so handling that many variables might prove impossible.&lt;/P&gt;
&lt;P&gt;Rethink your data structure.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That statement is not true. Variables are limited to 32,767. Macro variables are twice that. Statement as far as I know have no limit.&lt;/P&gt;
&lt;P&gt;Try running this code that will create a LABEL statement that is more can 64K characters long.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;

data _null_;
 length name $32 label $256 ;
 file code lrecl=300 ;
 put 'label';
 do i=1 to 300 ;
   name = cats('VAR',i);
   label = 'label for ' || name ;
   put '  ' name $32. '="' label $256. '"' ;
 end;
 put ';' ;
run;

data test;
 array xx var1-var300 ;
 %include code ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You're right. I confused this with the limits of a put statement, which comes into play when proc export tries to write the header for a csv file.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 08:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Common-SAS-issue-with-lists/m-p/409005#M99901</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-31T08:10:51Z</dc:date>
    </item>
  </channel>
</rss>

