Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Eric Booth <ebooth@ppri.tamu.edu> |
To | "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: [Stata 12] Issue with -export excel- |
Date | Wed, 27 Jul 2011 18:03:19 +0000 |
<> I think I've figured out the _1st question in my previous post. I used -cf- to compare the files created by -input- and the snippet of my original data (stored in my DB). -cf- revealed that the 'remarks' variable was different for the first observation. I pasted the first obs from each dataset into a text editor and they looked the same to me, but then I used -charlist- from SSC to look at the ascii for obs 1 in each dataset. In the original, raw dataset, there was the invisible ascii char 20. By removing it from 'remarks' via: replace remarks = subinstr(remarks, "`=char(20)'", "", .) I was able to -export excel- without issue. I still haven't come up with anything for my second 2 questions in my previous post. - Eric On Jul 27, 2011, at 11:50 AM, Eric Booth wrote: > <> > > 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). > <snip> > > *******************! > clear > 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" > end > > **From input statement: > export excel * using "frominput.xlsx", replace sheet("one") cell(A2) > > **From .dta: > u "http://dl.dropbox.com/u/428249/testdata.dta";, 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: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/