[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Susanne und Uli Kohler <suli.kohler@web.de> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: forvalues question |

Date |
Sun, 9 May 2004 21:10:48 +0200 |

In addition to the answers of others, note the package -mkdat- on http://www.sowi.uni-mannheim.de/ado It is an ado-package to make retrivals of GSOEP data easier. regards uli Am Freitag, 7. Mai 2004 22:31 schrieb Dasovic, Josip: > I am working with the GSOEP (German Socioeconomic) panel survey. I have a > series of files for each of seventeen waves of the data, which are labeled > such that the file denoting the first year (wave) of data begins with the > letter a, the file denoting the second year (wave) of data begins with the > letter b, etc.. What I would like to do is to open each of the seventeen > files, keep the person id variable, and another variable, then save these > new files using the same filename as the original, with one small > exception--renaming the files with the year name (1984,1985, etc.) at the > end of the filename, dropping the wave-denoting letters (a,b, etc.) from > the filename altogether. To make this easier, I have created a short > forvalues loop: > > local wave "a b c d e f g h i j k l m n o p q r" > local i=1985 > > while `i'<=2001 { > foreach x of local wave { > use "C:\Directory\`x'filename.dta", clear > keep personid `x'variable > save "C:\Directory\filename`i'.dta", replace > } > } > > Once again, the successive year files begin with a letter matched to a > particular year; afilename, bfilename, cfilename, etc., where a=1985, > b=1986...r=2001. > > The short program above should open the file afilename.dta, keep the > required variables, and save the new file as filename1985.dta, and so on. > > The problem is that Windows doesn't seem to recognize the `x' after the \ > symbol (in the third line of the program above). Is there a way to get > around this? I assume that Windows is disturbed by the placement of the > symbols \` beside each other. > > Stata gives me the following error message: > > file C:`x'filename.dta not found > > Thanks in advance, > > Josip > > > * > * 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/ * * 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/

**References**:**st: forvalues question***From:*"Dasovic, Josip" <Josip_Dasovic@brown.edu>

- Prev by Date:
**Re: st: About log file** - Next by Date:
**RE: st: plot predicted effects after regression** - Previous by thread:
**st: Re: forvalues question** - Next by thread:
**re: st: forvalues question** - Index(es):

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