<?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: exporting xlsx files to Google drive in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304147#M270489</link>
    <description>&lt;P&gt;Thanks for putting me on the right track. I tried this (albeit a simpler version of the code) and it works well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods excel file="C:\Users\gbibb\Google Drive\alt.xlsx";&lt;BR /&gt;proc print data=final;&lt;BR /&gt;run;&lt;BR /&gt;ods excel close;&lt;BR /&gt;proc print;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2016 16:41:27 GMT</pubDate>
    <dc:creator>GreggB</dc:creator>
    <dc:date>2016-10-12T16:41:27Z</dc:date>
    <item>
      <title>exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304072#M270477</link>
      <description>&lt;P&gt;I'm running SAS 9.4 on a PC with windows 8.1. I regularly need to export xlsx files to several shared folders and I use a macro to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem: if I export an xlsx file, it can't be opened with Google sheets. If I choose the download option, the error says the file is corrupt. Other coworkers have the same problem when they try to open my files. As an alternative, I export the files in csv format. These files can be opened and/or downloaded. The problem with using csv format is that the data contains student IDs which are 12 digits long. They get corrupted in the csv file. I have also tried exporting the files as xlsb but result is the same as with the xlsx files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone point me to any documentation that addresses this issue? &amp;nbsp;I've yet to find any.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304072#M270477</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T14:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304079#M270478</link>
      <description>Hi:&lt;BR /&gt;  How are you doing the EXPORT? Using PROC EXPORT or using ODS. It says here: &lt;A href="https://support.google.com/docs/answer/40608?hl=en" target="_blank"&gt;https://support.google.com/docs/answer/40608?hl=en&lt;/A&gt; that Google sheets will take an XLSX file. In that case, if you are running SAS 9.4, you might try using ODS EXCEL with TAGATTR to specify a that your student ID is text.&lt;BR /&gt;&lt;BR /&gt;My guess is that something in how you create the file is not creating an XLSX file that Google respects. When you use PROC EXPORT, what DBMS= option do you use? For example if you use DBMS=XLS, but name the file with XLSX file extension, that would not result in a VALID XLSX file for import by Google sheets.&lt;BR /&gt;&lt;BR /&gt;Can you clarify a bit more or show more of your code for doing the export?&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Wed, 12 Oct 2016 14:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304079#M270478</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-12T14:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304087#M270479</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just to note, you mention that CSV files get "corrupted" on the ID field. &amp;nbsp;I would suggest to check the output text file, what is generally the case is that this is an Excel "feature". &amp;nbsp;CSV means Comma Separated Variable file. &amp;nbsp;It is a plain text file with data delimited with commas - it is &lt;STRONG&gt;not&amp;nbsp;&lt;/STRONG&gt; an Excel file. &amp;nbsp;Excel automatically associates itself with CSV and has a built in reader to parse CSV files, however one of the "features" of this parser is that when it thinks the data is numbers it will strip off preceding 0's. &amp;nbsp;This is true of most export functionality and requires some additional coding to get round, for instance with tagset output you need to specify the tagset settings so that Excel interprets the field as text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any reason to want to use Excel? &amp;nbsp;In almost all outputs I would prefer to use PDF for reports, then tend to remain pretty stable across platforms/readers. &amp;nbsp;For data transfer the CSV should operate as expect. &amp;nbsp;If you really require and Excel file then post your export code.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304087#M270479</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-12T14:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304088#M270480</link>
      <description>&lt;P&gt;***** GET NUMBER OF LEVELS/SCHOOLS. *****;&lt;BR /&gt;data _null_;&lt;BR /&gt; set schools nobs=numobs;&lt;BR /&gt; if _n_=1;&lt;BR /&gt; call symput('numschools',compress(put(numobs,15.)));&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;***** GET DATE AS MACRO VARIABLE. *****;&lt;BR /&gt;data _null_;&lt;BR /&gt; call symput('rundate',trim(left(put(today(),worddate.))));&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;***** PRINT FOR EACH SCHOOL. *****;&lt;BR /&gt;%macro schrpts;&lt;/P&gt;
&lt;P&gt;%do schoolcnt=1 %to &amp;amp;numschools;&lt;/P&gt;
&lt;P&gt;***** GET NEXT SCHOOL. *****;&lt;BR /&gt;data _null_;&lt;BR /&gt; set schools;&lt;BR /&gt; if _n_=&amp;amp;schoolcnt;&lt;BR /&gt; call symput('school',trim(tranwrd(school,'- Charter','')));&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc export data=final (where=(school="&amp;amp;school")) &lt;BR /&gt;outfile="C:\Users\gb\Google Drive\&amp;amp;school.\Alt Assess\AltAssessRoster_&amp;amp;sysdate. - &amp;amp;school..xlsx" dbms=xlsx&lt;BR /&gt;replace;&lt;BR /&gt;run;&lt;BR /&gt;***** END SCHOOL LOOP. *****;&lt;BR /&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend schrpts;&lt;/P&gt;
&lt;P&gt;%schrpts;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304088#M270480</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T14:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304092#M270481</link>
      <description>&lt;P&gt;If I use pdf then the person I'm sharing it with couldn't edit it, correct? The reason for sharing the file is so others (non &amp;nbsp;SAS users) can verify that the data is correct and leave any comments for me.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304092#M270481</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T14:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304094#M270482</link>
      <description>&lt;P&gt;The ID field is ok until someone opens the file. Then, an ID such as 730123456789 gets changed to 730000000000.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304094#M270482</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T14:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304097#M270483</link>
      <description>&lt;P&gt;Dangerous is you ask me. &amp;nbsp;Giving users the option to change data and do things with it, we always lock it, and have a separate document to hold comments. &amp;nbsp;Anyways, each to their own. &amp;nbsp;For your problem you can try:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set schools;
  call execute('ods tagsets.excelexp file="&amp;lt;path&amp;gt;\',strip(school),'.xlsx";
                proc report data=schools nowd;
                  columns id ...;&lt;BR /&gt;                  where school="',strip(school),'";
                  define id / "label" style={tagattr='format:text'};
                  ...;
                run;
                ods tagstes.excelxp close;');
run;&lt;/PRE&gt;
&lt;P&gt;This will generate one file per school in the dataset (I assume they are unique!) using ods tagsets. &amp;nbsp;Note the stipulation of tagattr to set ID to be text, otherwise you will still get that Excel removing 0's feature.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304097#M270483</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-12T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304104#M270484</link>
      <description>&lt;P&gt;I'll give this a try. The actual data resides in our student info system which is inaccessible to them, but your point is well-taken. Yes, each school is unique.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304104#M270484</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T14:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304132#M270485</link>
      <description>&lt;P&gt;What version of SAS 9.4?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODS Excel is also an option.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 15:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304132#M270485</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-12T15:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304137#M270486</link>
      <description>&lt;P&gt;Not sure. &amp;nbsp;Is this what you mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS 9.4 TS Level 1M3&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 15:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304137#M270486</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T15:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304143#M270487</link>
      <description>&lt;P&gt;Yes. You can generate native XLSX files with ODS excel, similar to ODS Tagsets.excelxp.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 16:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304143#M270487</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-12T16:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304144#M270488</link>
      <description>&lt;P&gt;Yes. You can generate native XLSX files with ODS excel, similar to ODS Tagsets.excelxp.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 16:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304144#M270488</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-12T16:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304147#M270489</link>
      <description>&lt;P&gt;Thanks for putting me on the right track. I tried this (albeit a simpler version of the code) and it works well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods excel file="C:\Users\gbibb\Google Drive\alt.xlsx";&lt;BR /&gt;proc print data=final;&lt;BR /&gt;run;&lt;BR /&gt;ods excel close;&lt;BR /&gt;proc print;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 16:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304147#M270489</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-12T16:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304187#M270490</link>
      <description>&lt;P&gt;If you want to "protect" the ID number, you need to explicitly tell Excel that it is text or give excel a format that Microsoft respects. See the use of TAGATTR in the program and the results below. Note how TAGATTR gives HEIGHT and WEIGHT 3 decimal places and how the START and ID numbers are not changed.&lt;BR /&gt; &lt;BR /&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5269iFAEDF716A537A8A6/image-size/original?v=v2&amp;amp;px=-1" alt="ods_excel_approach_tagattr.png" title="ods_excel_approach_tagattr.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 20:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304187#M270490</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-12T20:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304190#M270491</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas﻿&lt;/a&gt;&amp;nbsp;Doesn't ODS EXCEL handle some of that, so you don't have to deal with TAGATTR as much?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 20:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304190#M270491</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-12T20:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304191#M270492</link>
      <description>Hi, Reeza:&lt;BR /&gt;  In my experience, ODS Excel is generally very, very good with Dates and will respect the SAS format for date/time values. I still find that I usually need TAGATTR for long numbers, leading zeroes, percents and number of decimal places.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Wed, 12 Oct 2016 20:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304191#M270492</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-12T20:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304358#M270493</link>
      <description>&lt;P&gt;My comments about the 12-digit IDs may have been misleading. There's no problem on the SAS side. The corruption occurs when other users open the csv file. This is no longer a problem since I learned to use ODS to export an xlsx file.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 13:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304358#M270493</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-13T13:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304359#M270494</link>
      <description>&lt;P&gt;Yes. ODS handled it with no problem.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 13:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304359#M270494</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-13T13:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: exporting xlsx files to Google drive</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304421#M270495</link>
      <description>Hi: Just to further clarify that I knew there was no problem on the SAS side of things. SAS doesn't really care how big a number it has to display as long as your SAS format is big enough to display the number with all the punctuation (commas, decimal points, etc). But Microsoft Excel does not always respect big numbers and past a certain size, has a tendency to replace significant digits in the number with zeroes.&lt;BR /&gt;&lt;BR /&gt;Sometimes you can work around this issue by telling Microsoft that the number is a text string, but that doesn't always work. Usually, in cases where Excel does not use the SAS format, as written to the CSV file, you need to "move up" to use ODS to create more than a CSV file -- both ODS TAGSETS.EXCELXP and ODS EXCEL give you the ability (via TAGATTR) to specify a Microsoft format instruction for Excel to use when it opens the file you create. This is a key point -- you are NOT sending a SAS format with TAGATTR and ODS -- you are sending a Microsoft format. &lt;BR /&gt;&lt;BR /&gt;As Reeza suggested, there are some SAS formats that the TAGSET destinations will automatically convert to Microsoft formats for you -- that was the posting exchange we had about date formats. I find the TAGATTR method of sending Microsoft formats to be very reliable, when the file is opened with Excel. I am glad to hear that Google sheets also supports the Microsoft format.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Thu, 13 Oct 2016 16:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exporting-xlsx-files-to-Google-drive/m-p/304421#M270495</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-13T16:49:03Z</dc:date>
    </item>
  </channel>
</rss>

