Statalist


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

st: Insheet with dictionary


From   Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Insheet with dictionary
Date   Wed, 15 Jul 2009 12:08:33 +0100

Dear Statalist,
I need to import 12 large datasets from Excel to Stata and I was wondering whether anyone could suggest a more efficient way than the one I came up with.
The variables in my datasets are named in Japanese so if I simply insheet the datasets the resulting Stata files have v1, v2 etc instead of variable names and contain question marks instead of variable labels. My datasets all have similar structure, so I thought that the most efficient way would be writing a dictionary for one of them and use this dictionary to insheet the relevant Excel file and then modifying the dictionary for each subsequent dataset (they are similar, but not identical).
The problem is that writing even one dictionary is proving extremely repetitive work and I was wondering whether there might be a way of somehow automating it with something like foreach?



The beginning of my dictionary looks as follows: 

dictionary using general data Tokyo ku merged.csv {
totalall1519 labmarkall1519 wrkall1519 paywrkall1519 unempall1519 notlabmarkall1519 empstunknall1519 unemprateall1519 unmarrall1519 marrall1519 widall1519 divall1519 marstunkn1519
}  

The numbers in the name of each variable mean age => these are various demographic characteristics of 15-19 year olds, the dataset then goes on and contains the same demographic measurements for older age groups until 70-74 year olds. I of course can simply copy paste this part of the dictionary for each age group and only replace the numbers representing age groups, but I was wondering if anyone could suggest a better way?
I would be most grateful for any advice,
Sincerely yours,
Ekaterina   

-- 
Ekaterina Hertog (nee Korobtseva)
Nissan Institute of Japanese Studies
27 Winchester Road, Oxford
OX2 6NA

*
*   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/



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