<?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: Array with unknown number of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83105#M17923</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can only use (*) as the dimension for an array definition when the variables in question already exist.&lt;/P&gt;&lt;P&gt;You could try adding a third macro parameter to specify the number of expected values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%MACRO CUSTOMER_NUMBER(HTML_TAG,SAS_NAME,&lt;STRONG&gt;NCOL&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;array &amp;amp;SAS_NAME. (&lt;STRONG&gt;&amp;amp;NCOL&lt;/STRONG&gt;) $8.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you cannot know in advance how many copies there will be then you probably need to add conditional to the DO loop to prevent reading past the end of the file.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; infile in flowover &lt;STRONG&gt;end=eof&lt;/STRONG&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; do col=1 to dim(&lt;STRONG&gt;&amp;amp;NCOL&lt;/STRONG&gt;) &lt;STRONG&gt;while (not eof)&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 15 Sep 2013 12:36:33 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-09-15T12:36:33Z</dc:date>
    <item>
      <title>Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83104#M17922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to download some customer number data from a company intranet site.&amp;nbsp; Attempting to adapt some code that Tom gave me (thanks again!) which downloads data from the internet using an input statement.&amp;nbsp; Code works fine when I &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;specify the number of customer numbers.&amp;nbsp; Unfortunately, the number of customers is unknown.&amp;nbsp; There may be 10 or 100. The number varies based on company region and other characteristics.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Note I tried using the DIM(var) syntax to obtain the dimensions of the array, but I get the following error message: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: The array CUST_NUM has been defined with zero elements.&lt;/P&gt;&lt;P&gt;ERROR: Too many array subscripts specified for array CUST_NUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the code I'm using.&amp;nbsp; Does anyone have any suggestions on how to define the array such it'll be able to handle varying numbers of customers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for any help or advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Bill&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again when I run this code I get the above error message.&lt;/P&gt;&lt;P&gt;%MACRO CUSTOMER_NUMBER(HTML_TAG,SAS_NAME);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;SAS_NAME.;&lt;/P&gt;&lt;P&gt;infile in flowover ;&lt;/P&gt;&lt;P&gt;input @&amp;amp;HTML_TAG. @;&amp;nbsp; /*START*/&lt;/P&gt;&lt;P&gt;array &amp;amp;SAS_NAME. (*) $8.;&lt;/P&gt;&lt;P&gt;do col=1 to dim(&amp;amp;SAS_NAME.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input @ '/q?s='&amp;nbsp; &amp;amp;SAS_NAME.(col) $8. @;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop col;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;&lt;P&gt;%CUSTOMER_NUMBER('&amp;gt;Preferred Customers&amp;lt;',CUST_NUM);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Sep 2013 11:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83104#M17922</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-15T11:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83105#M17923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can only use (*) as the dimension for an array definition when the variables in question already exist.&lt;/P&gt;&lt;P&gt;You could try adding a third macro parameter to specify the number of expected values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%MACRO CUSTOMER_NUMBER(HTML_TAG,SAS_NAME,&lt;STRONG&gt;NCOL&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;array &amp;amp;SAS_NAME. (&lt;STRONG&gt;&amp;amp;NCOL&lt;/STRONG&gt;) $8.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you cannot know in advance how many copies there will be then you probably need to add conditional to the DO loop to prevent reading past the end of the file.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; infile in flowover &lt;STRONG&gt;end=eof&lt;/STRONG&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; do col=1 to dim(&lt;STRONG&gt;&amp;amp;NCOL&lt;/STRONG&gt;) &lt;STRONG&gt;while (not eof)&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Sep 2013 12:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83105#M17923</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-15T12:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83106#M17924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you show example of the site you are reading from.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Sep 2013 12:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83106#M17924</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-15T12:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83107#M17925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your thoughts.&amp;nbsp; I tried to implement your solution by specifying an arbitrarily large number of customers and then using the conditional DO loop to prevent reading past the end of the file.&amp;nbsp; I can see the data in the log!&amp;nbsp; However, I get a "LOST CARD" error and SAS doesn't output any records to the data set.&amp;nbsp; I tried using the MISSOVER command in the infile statement but that set all the data to blank.&amp;nbsp; Am I correctly using the conditional DO loop as you suggested?&amp;nbsp; Should it be a loop within a loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the revised code.&amp;nbsp; Note it works fine when I specify NCOL=10.&amp;nbsp; When I put NCOL=100, I get a "LOST CARD" error and no data records are output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET NCOL=100;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%MACRO CUSTOMER_NUMBER(HTML_TAG,SAS_NAME);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data &amp;amp;SAS_NAME.;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;infile in flowover &lt;/SPAN&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end=eof&lt;/STRONG&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;input @&amp;amp;HTML_TAG. @;&amp;nbsp; /*START*/&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;array &amp;amp;SAS_NAME. (&amp;amp;NCOL.) $8.;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;do col=1 to dim(&amp;amp;SAS_NAME.) while (not eof);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; input @ '/q?s='&amp;nbsp; &amp;amp;SAS_NAME.(col) $8. @;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;end;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;drop col;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%MEND;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%CUSTOMER_NUMBER('&amp;gt;Preferred Customers&amp;lt;',CUST_NUM);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Sep 2013 22:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83107#M17925</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-15T22:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83108#M17926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data_null_;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the response.&amp;nbsp; Unfortunately, I can't give an example of the website since it's a company intranet site.&amp;nbsp; However, the code I'm using is almost working.&amp;nbsp; I just need to figure out how to generalize it, so it'll handle an unknown number of customers.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bill &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Sep 2013 22:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83108#M17926</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-15T22:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83109#M17927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Substitute the data contained within the website with something generic.&amp;nbsp; It is difficult to help you if you can't provide a basic structure of the data you are reading.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2013 05:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83109#M17927</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-09-16T05:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83110#M17928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My apologies for 1) not having an example and 2) taking a long time to respond (work has been crazy this week).&amp;nbsp; Here's some code that pulls the names of LinkedIn insiders who've traded the stock in the last 2 years from yahoo finance.&amp;nbsp; The structure of the table on yahoo is very similar to the table on the intranet page that I'm working with. Also, both programs get the exact same error when I set the NCOL (number of columns) variable to something large, e.g., 50.&amp;nbsp; (SAS comes back with a "LOST CARD" error and states "SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the end of a line."&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Note the program runs fine when I set the NCOL = 10.&amp;nbsp; Note I'm setting the number of columns to an arbitrarily large number because I don't know how many insiders traded the stock during the past &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;2 years.&amp;nbsp; Is there any easy way to count them before hand and then specify the number of columns correctly?&amp;nbsp; Or is it advisable to simply pick a large number and then delete any records with missing data?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for any help or advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;DM 'CLEAR LOG';&lt;/P&gt;&lt;P&gt;OPTIONS SPOOL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO INSDIER(HTML_TAG,SAS_NAME);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;filename in url "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://finance.yahoo.com/q/it?s=LNKD+Insider+Transactions"&gt;http://finance.yahoo.com/q/it?s=LNKD+Insider+Transactions&lt;/A&gt;&lt;SPAN&gt;" lrecl=32000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;infile in length=len;&lt;/P&gt;&lt;P&gt;input record $varying32000. len;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET NCOL=50; /*set the number of columns to an arbitrarily large number to ensure all insider info is recorded*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;SAS_NAME.;&lt;/P&gt;&lt;P&gt;infile in flowover end=eof;&lt;/P&gt;&lt;P&gt;input @&amp;amp;HTML_TAG. @;&amp;nbsp; /*START*/&lt;/P&gt;&lt;P&gt;array &amp;amp;SAS_NAME. (&amp;amp;NCOL.) $25.;&lt;/P&gt;&lt;P&gt;do col=1 to dim(&amp;amp;SAS_NAME.) while (not eof);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input @ '8557.html"&amp;gt;'&amp;nbsp; string $25. @; /*GRAB 25 CHARACTERS AFTER TAG*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;amp;SAS_NAME.(col)=input(scan(string,1,'&amp;lt;'),??$25.); /*SCAN STRING AND KEEP UP TO &amp;lt;*/&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop col string;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;&lt;P&gt;%INSDIER('&amp;gt;Insider Transactions Reported - Last Two Years&amp;lt;',INSIDER);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 10:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83110#M17928</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-20T10:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83111#M17929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just read the names as observations instead of into and array.&amp;nbsp; You don't know how many you need.&amp;nbsp; You also needed larger LRECL.&amp;nbsp; When doing the "blind scan" you can either live with LOSTCARD or use INFILE statement option EOF instead of END.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;%MACRO&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; INSDIER(&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;HTML_TAG&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;SAS_NAME&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;)&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;filename in url &lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://finance.yahoo.com/q/it?s=LNKD+Insider+Transactions"&gt;http://finance.yahoo.com/q/it?s=LNKD+Insider+Transactions&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; lrecl=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1000000&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;data test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; infile in length=len truncover;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; input @;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; recno + &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; reclen = len;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; do block=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; by &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input record &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$char128.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if missing(record) then leave;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; NCOL=50; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/*set the number of columns to an arbitrarily large number to ensure all insider info is recorded*/&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;data &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;SAS_NAME.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; infile in scanover eof=eof;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; input @&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;HTML_TAG.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/*START*/&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; length &amp;amp;sas_name $&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;25&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; do i = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; by &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input @ &lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://biz.yahoo.com"&gt;http://biz.yahoo.com&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;SAS_NAME=scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/*SCAN STRING AND KEEP UP TO &amp;lt;*/&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; eof: stop;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; drop string;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;%MEND&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;mprint&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;%&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #000000; background-color: #ffffff;"&gt;INSDIER&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;Insider Transactions Reported - Last Two Years&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,INSIDER);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 11:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83111#M17929</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-20T11:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83112#M17930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data_null_;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help. Program works perfectly now!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 12:53:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83112#M17930</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-20T12:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83113#M17931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data_null_;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for the code. Quick question: Currently, I'm using a macro to create separate data sets for each variable of interest and then merging the information.&amp;nbsp; Is there a way to easily modify the code such that it can capture more than one variable in a data step?&amp;nbsp; Using the insider information example, suppose I wanted to capture the insider type(director, officer) along with the insider name (html tags in code below).&amp;nbsp; Is this possible to do in one data step?&amp;nbsp; If this is a pain, then please don't worry about it.&amp;nbsp; The code you gave me works really well.&amp;nbsp; I'm just trying to make the program as efficient as possible.&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Bill&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current code uses macro to create separate data sets for each variable of interest (e.g., INSIDER_NAME, INSIDER_TYPE):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DM 'CLEAR LOG';&lt;/P&gt;&lt;P&gt;OPTIONS SPOOL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;filename in url "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://finance.yahoo.com/q/it?s=LNKD+Insider+Transactions"&gt;http://finance.yahoo.com/q/it?s=LNKD+Insider+Transactions&lt;/A&gt;&lt;SPAN&gt;" lrecl=1000000; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile in length=len truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input @;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; recno + 1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; reclen = len;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do block=1 by 1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input record $char128. @;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if missing(record) then leave;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET MAIN_HTML_TAG='&amp;gt;Insider Transactions Reported - Last Two Years&amp;lt;';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO INSIDER_VARS(SAS_NAME,VAR_HTML_TAG,FORMAT);&lt;/P&gt;&lt;P&gt;data &amp;amp;SAS_NAME.; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile in scanover eof=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input @&amp;amp;MAIN_HTML_TAG. @;&amp;nbsp; /*START*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; length &amp;amp;sas_name $25; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do i = 1 by 1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INPUT @ &amp;amp;VAR_HTML_TAG. @'&amp;gt;' STRING &amp;amp;FORMAT. @;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;SAS_NAME=INPUT(SCAN(STRING,1,'&amp;lt;'),??&amp;amp;FORMAT.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; eof: stop; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drop string;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;%MEND; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;options mprint=1; &lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%INSIDER_VARS(INSIDER_NAME,'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://biz.yahoo.com',$40.);"&gt;http://biz.yahoo.com',$40.);&lt;/A&gt;&lt;/P&gt;&lt;P&gt;%INSIDER_VARS(INSIDER_TYPE,'&amp;lt;span style="font-size:90%; display:block;"',$40.);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 07:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83113#M17931</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-26T07:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83114#M17932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes can read everything at once, just more of the same so to speak.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; insidertrans;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; in &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;scanover&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;eof&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=eof;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;Insider Transactions Reported - Last Two Years&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/*START*/&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; name title $&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;25&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; shares &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;8&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; type $&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;10&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; transaction $&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;40&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; i = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;by&lt;/SPAN&gt; &lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://biz.yahoo.com"&gt;http://biz.yahoo.com&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +(-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;40&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NAME=scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;); &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/*SCAN STRING AND KEEP UP TO &amp;lt;*/&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;span style="font-size:90%; display:block;"'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +(-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;40&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;title&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'class="yfnc_tabledata1"'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +(-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;40&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shares=input(scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;comma12.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'class="yfnc_tabledata1"'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +(-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;40&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type=scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'class="yfnc_tabledata1"'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; @&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; +(-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;40&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;) @;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transaction=scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'&amp;lt;'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;end&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; eof: &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;stop&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;*drop string;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 11:22:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83114#M17932</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-26T11:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83115#M17933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for the updated code!!!&amp;nbsp; It eliminates the need to merge the data in a subsequent data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 11:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83115#M17933</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-26T11:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83116#M17934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is one more variable I forget to include but you should be able to do that with no problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 12:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83116#M17934</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-26T12:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83117#M17935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With the code you gave me, picking up the last variable should be no problem whatsoever.&amp;nbsp; Just a few more questions if you don't mind: What's the purpose of the +(-40) in the input statement?&amp;nbsp; Is it related to the variable with the greatest length?&amp;nbsp; In other words, if the variable with the greatest length was $60, then the code would be +(-60)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, do you know of any good references for mastering the input statement?&amp;nbsp; I have a LOT to learn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 08:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83117#M17935</guid>
      <dc:creator>BillJones</dc:creator>
      <dc:date>2013-09-27T08:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Array with unknown number of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83118#M17936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used +(-40) to move backward the amount that was read by STRING $40.&amp;nbsp; I don't think this is necessary but it thought it might happen that reading in the STRING could move the pointer past the next "target" of the @'&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'class="yfnc_tabledata1" &lt;/SPAN&gt;bit.&amp;nbsp; If you read string $60. then your would move back +(-60), or $10.&amp;nbsp; +(-10)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 12:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-with-unknown-number-of-variables/m-p/83118#M17936</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-09-27T12:59:56Z</dc:date>
    </item>
  </channel>
</rss>

