<?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: proc export csv file to excel - error msg in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943722#M369850</link>
    <description>&lt;P&gt;CSV files are flat text files and do not have "sheets". Excel, after it is done reading them treats them as having sheets but the native CSV file that SAS creates does not recognize "sheet". So just remove the SHEET.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if your recipient is going to read the CSV file into a real data management system, or SAS, there is no reason to split the file. That is only an EXCELism with row limits. CSV files per se do not have a row limit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65907"&gt;@wlierman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I pulled 1,499,754 obs from a business objects warehouse.&amp;nbsp; I ran into the excel row limitation of 1,048,576 rows.&amp;nbsp; I exported the file as a csv to path on the SAS server.&amp;nbsp; Then I used SAS to import the&amp;nbsp; file and split the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc import datafile = "M:\Data\OR0206965\2845_CMS_Quarterly 2024_Q2 _ 1486138___9.11.2024.csv"
            out = ANALYZE3.DRTS_2845_OHP_Monitoring
            dbms = csv
			replace;
			getnames=yes;
			run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then split the file into two parts&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* SPLITTING CSV FILE INTO PARTS */
/* Split SAS dataset into part 1 */
DATA ANALYZE3.DRTS_2845_Firstpart;
SET ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 1 obs = 750000);
run;

/* Split SAS dataset into part 2 */
DATA ANALYZE3.DRTS_2845_Secondpart;
SET ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 750001 obs = 1499754);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Everything is straightforward - nothing fancy.&lt;/P&gt;
&lt;P&gt;The next step is to export back to my computer so I can send to the original requestor. I'll include the code for the first split (the second is identical).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=ANALYZE3.DRTS_2845_Firstpart
    outfile = "C:/Users/OR0206965/DRTS_2845_1.csv"
	dbms = csv
	replace;
	sheet="SHEET_1";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem shows up in the log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;178  proc export data=ANALYZE3.DRTS_2845_Firstpart
179      outfile = "C:/Users/OR0206965/DRTS_2845_part1.csv"
180      dbms = csv
181      replace;
NOTE: The previous statement has been deleted.
182      sheet="SHEET_1";
         -----
         180
ERROR 180-322: Statement is not valid or it is used out of proper order.

183  run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is the problem. Likely very simple but I can't see the problem.&amp;nbsp; I have checked against similar proc export code that did run (in another project).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your corrections | suggestions will be very appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2024 22:47:06 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-09-12T22:47:06Z</dc:date>
    <item>
      <title>proc export csv file to excel - error msg</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943721#M369849</link>
      <description>&lt;P&gt;I pulled 1,499,754 obs from a business objects warehouse.&amp;nbsp; I ran into the excel row limitation of 1,048,576 rows.&amp;nbsp; I exported the file as a csv to path on the SAS server.&amp;nbsp; Then I used SAS to import the&amp;nbsp; file and split the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc import datafile = "M:\Data\OR0206965\2845_CMS_Quarterly 2024_Q2 _ 1486138___9.11.2024.csv"
            out = ANALYZE3.DRTS_2845_OHP_Monitoring
            dbms = csv
			replace;
			getnames=yes;
			run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then split the file into two parts&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* SPLITTING CSV FILE INTO PARTS */
/* Split SAS dataset into part 1 */
DATA ANALYZE3.DRTS_2845_Firstpart;
SET ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 1 obs = 750000);
run;

/* Split SAS dataset into part 2 */
DATA ANALYZE3.DRTS_2845_Secondpart;
SET ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 750001 obs = 1499754);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Everything is straightforward - nothing fancy.&lt;/P&gt;
&lt;P&gt;The next step is to export back to my computer so I can send to the original requestor. I'll include the code for the first split (the second is identical).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=ANALYZE3.DRTS_2845_Firstpart
    outfile = "C:/Users/OR0206965/DRTS_2845_1.csv"
	dbms = csv
	replace;
	sheet="SHEET_1";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem shows up in the log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;178  proc export data=ANALYZE3.DRTS_2845_Firstpart
179      outfile = "C:/Users/OR0206965/DRTS_2845_part1.csv"
180      dbms = csv
181      replace;
NOTE: The previous statement has been deleted.
182      sheet="SHEET_1";
         -----
         180
ERROR 180-322: Statement is not valid or it is used out of proper order.

183  run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is the problem. Likely very simple but I can't see the problem.&amp;nbsp; I have checked against similar proc export code that did run (in another project).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your corrections | suggestions will be very appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 22:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943721#M369849</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2024-09-12T22:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: proc export csv file to excel - error msg</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943722#M369850</link>
      <description>&lt;P&gt;CSV files are flat text files and do not have "sheets". Excel, after it is done reading them treats them as having sheets but the native CSV file that SAS creates does not recognize "sheet". So just remove the SHEET.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if your recipient is going to read the CSV file into a real data management system, or SAS, there is no reason to split the file. That is only an EXCELism with row limits. CSV files per se do not have a row limit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/65907"&gt;@wlierman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I pulled 1,499,754 obs from a business objects warehouse.&amp;nbsp; I ran into the excel row limitation of 1,048,576 rows.&amp;nbsp; I exported the file as a csv to path on the SAS server.&amp;nbsp; Then I used SAS to import the&amp;nbsp; file and split the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc import datafile = "M:\Data\OR0206965\2845_CMS_Quarterly 2024_Q2 _ 1486138___9.11.2024.csv"
            out = ANALYZE3.DRTS_2845_OHP_Monitoring
            dbms = csv
			replace;
			getnames=yes;
			run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then split the file into two parts&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* SPLITTING CSV FILE INTO PARTS */
/* Split SAS dataset into part 1 */
DATA ANALYZE3.DRTS_2845_Firstpart;
SET ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 1 obs = 750000);
run;

/* Split SAS dataset into part 2 */
DATA ANALYZE3.DRTS_2845_Secondpart;
SET ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 750001 obs = 1499754);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Everything is straightforward - nothing fancy.&lt;/P&gt;
&lt;P&gt;The next step is to export back to my computer so I can send to the original requestor. I'll include the code for the first split (the second is identical).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=ANALYZE3.DRTS_2845_Firstpart
    outfile = "C:/Users/OR0206965/DRTS_2845_1.csv"
	dbms = csv
	replace;
	sheet="SHEET_1";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The problem shows up in the log&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;178  proc export data=ANALYZE3.DRTS_2845_Firstpart
179      outfile = "C:/Users/OR0206965/DRTS_2845_part1.csv"
180      dbms = csv
181      replace;
NOTE: The previous statement has been deleted.
182      sheet="SHEET_1";
         -----
         180
ERROR 180-322: Statement is not valid or it is used out of proper order.

183  run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is the problem. Likely very simple but I can't see the problem.&amp;nbsp; I have checked against similar proc export code that did run (in another project).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your corrections | suggestions will be very appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 22:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943722#M369850</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-12T22:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: proc export csv file to excel - error msg</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943735#M369859</link>
      <description>&lt;P&gt;Did you want to make a CSV file or an EXCEL file?&amp;nbsp; They are NOT the same thing.&lt;/P&gt;
&lt;P&gt;If you want to make a CSV file then do not use the SHEET= statement as that makes no sense.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export
  data=ANALYZE3.DRTS_2845_OHP_Monitoring (obs = 750000)
  outfile = "C:/Users/OR0206965/DRTS_2845_1.csv"
  dbms = csv
  replace
;
run;
proc export
  data=ANALYZE3.DRTS_2845_OHP_Monitoring (firstobs = 750001)
  outfile = "C:/Users/OR0206965/DRTS_2845_2.csv"
  dbms = csv
  replace
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to make an EXCEL file than use XLSX as the DBMS and use xlsx as the extension.&amp;nbsp; Then you can use the SHEET= statement.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 01:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943735#M369859</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-13T01:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc export csv file to excel - error msg</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943736#M369860</link>
      <description>&lt;P&gt;If all you wanted to do was split the CSV file into two file why did you make it into a SAS dataset first?&lt;/P&gt;
&lt;P&gt;Copy the header first, then append the lines to the appropriate files.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename bigfile "M:\Data\OR0206965\2845_CMS_Quarterly 2024_Q2 _ 1486138___9.11.2024.csv" ;
filename file1 "C:/Users/OR0206965/DRTS_2845_1.csv";
filename file2 "C:/Users/OR0206965/DRTS_2845_2.csv";

data _null_;
  infile bigfile obs=1;
  input;
  file file1;
  put _infile_;
  file file2;
  put _infile_;
run;

data _null_;
  infile bigfile firstobs=2;
  input;
  if _n_&amp;lt;=75000 then file file1 mod;
  else file file2 mod;
  put _infile_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the data lines are longer than 32767 bytes then add LRECL= option to the INFILE and FILE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 01:25:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-export-csv-file-to-excel-error-msg/m-p/943736#M369860</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-13T01:25:19Z</dc:date>
    </item>
  </channel>
</rss>

