Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Reading a variable from a spreadsheet and saving it as a macro


From   Miles Grogger <[email protected]>
To   [email protected]
Subject   st: Reading a variable from a spreadsheet and saving it as a macro
Date   Tue, 6 Aug 2013 10:17:40 -0500

Hi all,

I'm trying to figure out how to create a small part of my program that will
allow me to import a worksheet, reshape it, and then create a macro based
on one of the variables. So far, my code for the problem section remains as
such:

local indir "/Users/milesgrogger/Dropbox/PAC_Facilities/FullChapters/1995-2011"
local outdir "/Users/milesgrogger/Desktop"
local fnames "c01_3_3_1995.xls c01_3_3_1996.xls c01_3_3_1997.xls"
local shnames ""3.3.5 " "3.3.5 " "3.3.7  ""

So far the contents of the macros `fnames' and `shnames' are just copy and
pasted in from a spreadsheet, but I would like a way to make that more
automated, since eventually I'll be needing to do this for 544 items. I
tried to create a macro by typing:
local macname "varname[1] varname[2] etc."
but when I cleared the dataset to make room for the next workbook, the
macros were cleared too.

Any help would be great.

Thanks,
Miles Grogger
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index