Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: help with insheeting data


From   Ian Watson <[email protected]>
To   [email protected]
Subject   Re: st: help with insheeting data
Date   Mon, 28 Nov 2005 16:24:06 +1100

Alexander Nerved asked about ways of outsheeting data from Stata, something which he does currently in Stat Transfer manually.

There are no doubt numerous ways to do this in Stata, but it's also possible to automate Stat Transfer to do various operations which you might be doing manually.

For example, here is some code to convert some SPSS data to Stata data.

winexec "c:\program files\stattransfer5\st" d:\data\varlist.stc

The varlist.stc file is a text file which lists the variables to bring in. A snippet of it follows:

vars "d:\data\source\Portable Rperson a30c.por"
XWAVEID // XW Cross wave ID
AHHRHID // DV: randomised household id
AHHRAID // DV: randomised area id
AHHRPID // DV: Randomised person ID
AHHPNO // HF Person Number
AHHIDATE // PQ Date of PQ interview


This can be easily modified to export from Stata data to ASCII fixed width. All the steps needed are documented in the Stat Transfer Command Processor help file.


Alexander Nervedi wrote:

Hi Statalist!

I am having issues with loading in data. I have a somewhat cumbersome
datatset - the data is first split into 10 domains, and within each domain,
I have data on a bunch of states in dbf format. Each state's file has two
state-cum-msa  identifiers and one 80 charecter long variable that needs to
be further split furhter according to a dictionary to get to the variables
for that state.

I can get to each of the files using

odbc load, table("statename") dns("data")

and then append them all to get one file that I can either output as a stata
file, or outsheet it.

So far so good.

The problem is that outsheeting it or even outfiling it introduces spaces in
the final file that mess up my dictionary file so that I can't read the 80
character long variable. The only way I can get it to work is by
Stat-transfering the file into *.dat format (ASCII Fixed Width + All program
setting).

Is there anyway I can export from within Stata to ASCII Fixed Width format?
This will automate the process of extracting my variables, instead of having
to manually run Stat Transfer on each time.

thank you,

Al

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/




--
Kind regards,
Ian

-------------------------------
Ian Watson
Senior Researcher
acirrt, University of Sydney
NSW, 2006, Australia

phone: 02 9351 5622
email:[email protected]
www.acirrt.com
-------------------------------


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index