<?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: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ? in Advanced Programming</title>
    <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726082#M79</link>
    <description>&lt;P&gt;Are ALL of the columns under date headings?&lt;/P&gt;
&lt;P&gt;If so, are they at a &lt;STRONG&gt;regular&lt;/STRONG&gt; interval, such as one column for each day, or the first day of a week or such?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the columns are regular enough it may be possible to read a csv into a better structured data set. Maybe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Mar 2021 06:31:21 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-14T06:31:21Z</dc:date>
    <item>
      <title>How can I import a large XLSX file for more than 7000 columns?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726048#M75</link>
      <description>&lt;P&gt;Hi, I am trying to import a large xlsx file (more than 7000 columns) into SAS by using two methods: PROC IMPORT AND LIBNAME. And all two of them are fail.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the first method: PROC IMPORT, I have an error that most of the columns name changed into VARxxxx and also have missing data. (By the way my columns name is in DATE type in Excel). Here is my code:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Options validvarname = any;
PROC IMPORT Datafile = " C:\Users\hp\Desktop\data_chung\Book1.xlsx"
DBMS = xlsx out = Test replace; Getnames = YES; RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the second method: LIBNAME, I have found this method for a several hours ago and still not really know how to use it in correctly. So the error is I can not open the file I have imported even the log show it was&amp;nbsp; successfully assigned. SAS shown me an message : " Multiple SAS files with this name exist. The table named X.RI will be opened" Then I clicked OK and then the error occured: " Access of sequential tables is not allowed in this viewer". Here is my code&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Libname x xlsx 'C:\Users\hp\Desktop\data_chung\Book1.csv' ;&lt;/PRE&gt;
&lt;P&gt;How can I fix these problems? Are there any solution for me to import a large file like this ? Please help me !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 07:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726048#M75</guid>
      <dc:creator>LBLong21</dc:creator>
      <dc:date>2021-03-15T07:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726058#M76</link>
      <description>&lt;P&gt;A CSV file can't be read with the XLSX engine, CSV files are read with a data step.&lt;/P&gt;
&lt;P&gt;Dates are not suitable for variable names, unless you work with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Either way, I suspect that so many columns might overwhelm PROC IMPORT.&lt;/P&gt;
&lt;P&gt;Since you seem to have a CSV file, you could create the data step dynamically if there is some logic for the variable names.&lt;/P&gt;
&lt;P&gt;After you manage to read the data into SAS, you immediately transpose to a long dataset layout. Dates are data and must not be stored as structure. See Maxim 19.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 19:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726058#M76</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-13T19:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726060#M77</link>
      <description>CSV files may be saved as an XLSX file and then you can use the LIBNAME XLSX engine. Alternatively, you can use INFILE and INPUT statements in a DATA step to read the CSV file and provide appropriate column names on the INPUT statement.</description>
      <pubDate>Sat, 13 Mar 2021 19:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726060#M77</guid>
      <dc:creator>SuCheeTay</dc:creator>
      <dc:date>2021-03-13T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726062#M78</link>
      <description>&lt;P&gt;Do you have an XLSX file or a CSV file? Those are totally different file formats and the right code to use depends on which type you have.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 19:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726062#M78</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-13T19:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726082#M79</link>
      <description>&lt;P&gt;Are ALL of the columns under date headings?&lt;/P&gt;
&lt;P&gt;If so, are they at a &lt;STRONG&gt;regular&lt;/STRONG&gt; interval, such as one column for each day, or the first day of a week or such?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the columns are regular enough it may be possible to read a csv into a better structured data set. Maybe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 06:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726082#M79</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-14T06:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726108#M80</link>
      <description>Dear Mr. KurtBremser,&lt;BR /&gt;Thank you for your advise, I have a mistake with the LIBNAME code. I have fixed and run again with an option but still nothing happened.&lt;BR /&gt;However, I have read Maxims of Maximally Efficient SAS Programmers, Maxim 19 and I think it very useful for me as a beginner. I want to know more detail about your solution, I have understood your idea but the data that I have imported not only have problem with the variable name but also the missing data. Hope you show me more.&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Mar 2021 12:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726108#M80</guid>
      <dc:creator>LBLong21</dc:creator>
      <dc:date>2021-03-14T12:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726110#M81</link>
      <description>&lt;P&gt;The first thing we need to know: is there any system to those 7K variable names?&lt;/P&gt;
&lt;P&gt;If no, a quick example of the header line of your csv is needed, so we can show you how to read that and dynamically create a data step that reads the data itself.&lt;/P&gt;
&lt;P&gt;Once that is done, we will also show you how to do the transpose.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 12:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726110#M81</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-14T12:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726126#M82</link>
      <description>Hi Tom, I have all of them. But the original is XLSX file.</description>
      <pubDate>Sun, 14 Mar 2021 14:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726126#M82</guid>
      <dc:creator>LBLong21</dc:creator>
      <dc:date>2021-03-14T14:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726128#M83</link>
      <description>&lt;P&gt;Hi ballardw, Yes all of the columns are under date headings. I am not sure about the regular&lt;SPAN&gt;&amp;nbsp;interval you are mention cause I have not check it yet. But for some first columns, my data is like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LBLong21_0-1615731824999.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55924i5A226599B52875C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LBLong21_0-1615731824999.png" alt="LBLong21_0-1615731824999.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 14:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726128#M83</guid>
      <dc:creator>LBLong21</dc:creator>
      <dc:date>2021-03-14T14:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726130#M84</link>
      <description>Dear Ms.SuCheeTay,&lt;BR /&gt;Thank you for your advise. I don't know how to provide appropriate column names on the INPUT statement that you have mention when I use the INFILE statement, can you show me more about it ? Cause the file is more than 7000 columns, I think it impossible for me to provide the variable name manually. Are there any MACRO ways ?&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Mar 2021 14:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726130#M84</guid>
      <dc:creator>LBLong21</dc:creator>
      <dc:date>2021-03-14T14:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726131#M85</link>
      <description>&lt;P&gt;So you are reading some type of report?&amp;nbsp; What is the first column that didn't make it into your photograph?&lt;/P&gt;
&lt;P&gt;What type of values to the cells that don't have "NA" in them contain?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will have more control over reading a CSV file since it is just text.&lt;/P&gt;
&lt;P&gt;Essentially you should read the dates from the first row and remember them.&amp;nbsp; You can then match them up with the values from the other rows.&amp;nbsp; Let's assume that you have two id columns (A and B in the spreadsheet) and an unknown number of columns of the actual data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So let's call the first two variables COLUMN1 and COLUMN2.&amp;nbsp; Then the code below will read the first row and collect the date values into a temporary array.&amp;nbsp; It will also count how many dates it found and use that to know how many values to read from each row.&amp;nbsp; Then for each row it will read the first two columns and then read each date headed column and convert the text in that column into a number in the variable VALUE.&amp;nbsp; &amp;nbsp; To save some space I had it ignore the NA values.&amp;nbsp; So essentially it is creating a sparse matrix.&lt;/P&gt;
&lt;PRE&gt;row col date value column1 column2 
1 1 2021-01-01 100 AA  BB
1 2 2021-01-02  105 AA BB
1 4 2021-01-04  106 AA BB
...&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tall ;
  infile 'myfile.csv' dsd truncover lrecl=1000000 ; 
  array dates [10000] _temporary_ ; 
  length row col date value 8; 
  length dummy $32 column1 column2 $200 ; 
  retain ncol 0; 
  if _n_=1 then do ; 
    input 2*dummy @; 
    do ncol=1 by 1 until(date=.); 
      input date :ddmmyy. @; 
      dates[ncol]=date; 
    end; 
    input; 
  end; 
  row+1; 
  input column1 column2 @ ; 
  do col=1 to ncol; 
    input dummy @; 
    if dummy ne 'NA' then do; 
      date=dates[col]; 
      value = input(dummy,32.); 
      output; 
    end; 
  end; 
  drop dummy; 
  format date yymmdd10.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you wanted to create a report that looked like your original spreadsheet you could use PROC REPORT using DATE as an across variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=tall;
  column row column1 column2  value,date ;
  define row / group noprint;
  define column1 / group;
  define column2 / group;
  define date / across ' ' ;
  define value / ' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you must read the XLSX file then read it without names. Then the values in the first row can be your column identifiers.&amp;nbsp; The presence of the NA values is probably going to mess up the conversion of the date values however.&amp;nbsp; SAS will be forced to make the column as character and the dates (if they really are dates in Excel) will be represented as strings of digits that represent the number Excel uses to store that date. So numbers in the 40K range. To convert them to dates first convert them to numbers and then adjust by the difference in how Excel and SAS start counting days.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;date = input(string,32.) + '30DEC1899'd ;
format date yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Mar 2021 15:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726131#M85</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-14T15:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: PLEASE HELP !! HOW CAN I IMPORT A LARGE XLSX FILE FOR MORE THAN 7000 COLUMNS ?</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726148#M86</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/373757"&gt;@LBLong21&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi ballardw, Yes all of the columns are under date headings. I am not sure about the regular&lt;SPAN&gt;&amp;nbsp;interval you are mention cause I have not check it yet. But for some first columns, my data is like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LBLong21_0-1615731824999.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55924i5A226599B52875C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LBLong21_0-1615731824999.png" alt="LBLong21_0-1615731824999.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;29/12/1989 is a Friday, 01/01/1990 is a Monday. So it appears that you might have work days, Monday through Friday. The question becomes, do you have holidays?&lt;/P&gt;
&lt;P&gt;And are the columns supposed to hold a numeric value and NA is just a "missing" result, or is there actual meaningful text? And if text, how long are the allowable values.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 18:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/How-can-I-import-a-large-XLSX-file-for-more-than-7000-columns/m-p/726148#M86</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-14T18:56:30Z</dc:date>
    </item>
  </channel>
</rss>

