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

Concatenating datasets that actually exist! (Was RE: st: RE: bar graph of multiple variables)


From   "Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Concatenating datasets that actually exist! (Was RE: st: RE: bar graph of multiple variables)
Date   Thu, 10 Mar 2005 06:12:29 -0000 (GMT)

David Harrison replied:

> The problem is that the filename needs to be in quotes (as it contains
> spaces)... try
>
> saving("`file`i''")
>
> Interestingly, built-in programs with the -saving()- option don't seem to
> suffer from this problem... for example
>
> sysuse auto
> tempfile test
> scatter headroom trunk, saving(`test')
>
> works fine, despite their being spaces in the path - it comes up with the
> DOS abbreviated version...  C:\DOCUME~1\ etc.

Sorry for the delay in response! Well, the suggested change worked, but it
only got me as far as:

. *Create data set: 7 variables with values {1, 2, 3}
. clear

. set obs 30
obs was 0, now 30

. qui {

.
. *Create frequency values
. qui {

.
. dsconcat `file1' `file2' `file3' `file4' `file5' `file6' `file7'
file C:\Documents.dta not found
r(601);

end of do-file
r(601);

Is this odd, considering that the lines

qui {
forv i = 1/7 {
        tempfile file`i'
        xcontract c`i', freq(freq) idnum(`i')  saving("`file`i''")
}
}

creates and prepares the seven tempfiles for -dsconcat-? Being a
programming dunce, I'm clearly missing something obvious. I'm only
pursuing this, by the way, because Richard Sherman's original problem is
an interesting one for me as well.

CLIVE NICHOLAS        |t: 0(044)7903 397793
Politics              |e: clive.nicholas@ncl.ac.uk
Newcastle University  |http://www.ncl.ac.uk/geps

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index