Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: [Stata 12] Issue with -export excel-

From   Eric Booth <>
To   "" <>
Subject   st: [Stata 12] Issue with -export excel-
Date   Wed, 27 Jul 2011 16:50:11 +0000


I'm working with a fresh install of Stata 12 MP on OSX 10.7 and have encountered a couple of issues:

__1. I tried to use -export excel- to export some data from my stata dataset, but when I tried to open the spreadsheet, Excel displayed an error saying the data was "unreadable" and needed repair.  I clicked the repair button and it said that it could not repaired and some data was lost (All but the numeric data).    

To create an example, I pasted the dataset to a do file for an -input- command.  -input-ing the data and -export excel- works for this example from a do-file.  The example code below uses -export excel- with the data from the -input- example as well as the original data (downloaded from my dropbox).  

__2.  In the example below, I have a section that will open the excel file if you are using Mac OSX.  The first loop (with the -if- statement on a separate line) opens the files; however, all my Stata 11 code uses the loop below that which has the -if- on the same line.  I wonder if something changed with -if- or -!- in Stata 12 that I need to update in all my code.

_3.  Finally, I like to block indent/shift my code to the right.  In Stata 11 the Command+] shortcut would shift code right.  In Stata 12, if you right click on selected text, the contextual menu mentions that the shortcut has changed to Command+} (which I guess would be Command+Shift+]), but this doesn't work.  I played with key combinations until I discovered that it's actually Fn+Control+].  I wonder if that's an error in the shortcut key assignment in Stata 12 or if there is a shortcut key combination from some other application that is interfering.  I checked the shortcut preference pane in "System Preferences", but I couldn't find anything that looks like it conflicts with this shortcut.  Unless other report seeing a different shortcut for this command, I should probably submit this one to Stata tech support.

inp   id	str9 causeno	str19 date	str244 remarks	
48422	"16285-E"	"2001-07-19 00:00:00"	"CASE INFORMATION SHEET"	
48423	"16285-E"	"2001-08-07 00:00:00"	"PROMISE PLEA FOR 09.12.01"	
48424	"16285-E"	"2002-01-03 00:00:00"	"PROMISE PLEA FOR 01.23.02"	
48425	"16285-E"	"2002-01-24 00:00:00"	"NISI - ALIAS ISSUED(04.03.02 RTD)"	
48426	"16285-E"	"2002-01-24 00:00:00"	"JUDGEMENT OF NISI"	
48427	"16285-E"	"2002-04-01 00:00:00"	"WAIVER, ATTORNEY, JURY TRIAL, AND OTHER RIGHTS"	
48428	"16285-E"	"2002-04-01 00:00:00"	"DL SUSPENSION ORDER FOR 90"	
48429	"16285-E"	"2002-04-01 00:00:00"	"RANGE OF PUNISHMENT"	
48430	"16285-E"	"2002-04-01 00:00:00"	"PLED GUILTY 300.00 + 287.25, (50.00 CRD), 4 JAIL"	
48431	"16285-E"	"2002-04-02 00:00:00"	"CRIMINAL HISTORY REPORT TO DPS"	
48432	"16285-E"	"2002-04-02 00:00:00"	"CONVICTION NOTICE TO DPS"	
48433	"17215-E"	"2001-10-01 00:00:00"	"COMPLAINT/AFFIDAVIT"	
48434	"17215-E"	"2001-10-01 00:00:00"	"INFORMATION"	
48435	"17215-E"	"2001-10-01 00:00:00"	"STATE READY"	
48436	"18145-E"	"2002-01-14 00:00:00"	"COMPLAINT/AFFIDAVIT"	
48437	"18145-E"	"2002-01-14 00:00:00"	"INFORMATION"	
48438	"18145-E"	"2002-01-14 00:00:00"	"STATE READY"	
48439	"18145-E"	"2002-01-16 00:00:00"	"REQUEST FOR COUNSEL - PUBLIC DEFENDER APPOINTED."	
48440	"18145-E"	"2002-01-22 00:00:00"	"1500 BOND BY FREEDOM - 01.15.02"	
48441	"18145-E"	"2002-01-28 00:00:00"	"POSTCARD MAILED(02.01.02 RTD)"	
48442	"18145-E"	"2002-02-11 00:00:00"	"PLED GUILTY 300.00 + 242.25, (542.25 CRD), 28 JAIL"	
**From input statement:  
export excel * using  "frominput.xlsx", replace sheet("one") cell(A2)

**From .dta:
u "";, clear
export excel * using  "fromdta.xlsx", replace sheet("one") cell(A2)


**opens the files:
foreach file in input dta {
 if "`c(os)'" == "MacOSX"	{
 	!open "from`file'.xlsx"
**gives an error:
foreach file in input dta {
 if "`c(os)'" == "MacOSX"	!open "from`file'.xlsx"
	**error:  "unrecognized command:  "frominput.xlsx invalid command name"

- Eric

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index