<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Stata and StatTransfer</title>
	<atom:link href="http://enoriver.net/index.php/2009/06/17/stata-and-stattransfer/feed/" rel="self" type="application/rss+xml" />
	<link>http://enoriver.net/index.php/2009/06/17/stata-and-stattransfer/</link>
	<description>computing for fun and profit</description>
	<lastBuildDate>Wed, 18 Apr 2012 00:10:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Gabi Huiber</title>
		<link>http://enoriver.net/index.php/2009/06/17/stata-and-stattransfer/comment-page-1/#comment-1129</link>
		<dc:creator>Gabi Huiber</dc:creator>
		<pubDate>Sun, 21 Jun 2009 17:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://enoriver.net/?p=749#comment-1129</guid>
		<description>I think the difference between st and stcmd is that the former implies the Stat/Transfer command COPY, while the latter requires an explicit command. So &quot;st&quot; and &quot;stcmd copy&quot; should be equivalent.</description>
		<content:encoded><![CDATA[<p>I think the difference between st and stcmd is that the former implies the Stat/Transfer command COPY, while the latter requires an explicit command. So "st" and "stcmd copy" should be equivalent.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric A. Booth</title>
		<link>http://enoriver.net/index.php/2009/06/17/stata-and-stattransfer/comment-page-1/#comment-1113</link>
		<dc:creator>Eric A. Booth</dc:creator>
		<pubDate>Fri, 19 Jun 2009 00:17:59 +0000</pubDate>
		<guid isPermaLink="false">http://enoriver.net/?p=749#comment-1113</guid>
		<description>There are probably several errors in the example code I put in my previous post, but here&#039;s one I noticed just as I hit the &#039;submit&#039; button,,,,the local macro for the `in&#039; directory needs an opening quote:

local in &quot;//server/serverpath/folder/&quot;</description>
		<content:encoded><![CDATA[<p>There are probably several errors in the example code I put in my previous post, but here's one I noticed just as I hit the 'submit' button,,,,the local macro for the `in' directory needs an opening quote:</p>
<p>local in "//server/serverpath/folder/"</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric A. Booth</title>
		<link>http://enoriver.net/index.php/2009/06/17/stata-and-stattransfer/comment-page-1/#comment-1112</link>
		<dc:creator>Eric A. Booth</dc:creator>
		<pubDate>Fri, 19 Jun 2009 00:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://enoriver.net/?p=749#comment-1112</guid>
		<description>Nice code...very helpful.

As far as other platforms go, your code should work if you change the filepaths (see my comment in your previous posting) and you convert the -winexec- command to -!- or -shell-.  

I have a similar job set up, but with a slightly different purpose. I&#039;ve got a task set up to periodically convert files copied over from our server using -stcmd-  (above you have just -st-...when I try just -st- Stata doesnt recognize the stat/transfer command (?)).  In a non-windows environment, you should really probably set up a cron job (versus the batch/.bat file used in windows) to perform this kind of periodic work, but I cheat and put the command

     Stata -b do dofile.do

in MacOSX&#039;s   &quot;iCal.app&quot;  as an event on the calendar, and tell it to run weekly on Friday at 6pm.

In &quot;dofile.do&quot; I put a loop containing the files to copied and converted using -stcmd-, so something like:


*******
local in //server/serverpath/folder/&quot;
local out &quot;/users/username/folder/&quot;

forvalues n = 1/1000 {
 tokenize `&quot; &quot;file`n&#039;&quot; &quot;newfile`n&#039;&quot; &quot;report`n&#039;&quot; &quot;anotherfile`n&#039;&quot; &quot;&#039;
while &quot;`1&#039;&quot; != &quot;&quot; {
	stcmd  &quot;`in&#039;`1&#039;.csv&quot; &quot;`out&#039;`1&#039;_converted`c(current__date)&#039;.dta&quot;   /y /q /od
        cap mkdir &quot;`in&#039;backup/`c(current_date)&#039;/&quot;, public
        copy &quot;`in&#039;`1&#039;.csv&quot;      &quot;`in&#039;backup/`c(current_date)&#039;/`1&#039;.csv&quot;, replace public
	mac shift
	}

*********

This should take all 1000 of each of the 4 file types (file, newfile, report, anotherfile) and convert them from .csv to .dta (or whatever file types you want...I just used these as an example here), put them in the new directory (out) with the current date in the folder name,  and then save a copy of the .csv file in the backup directory.    Note that I put the current date in the file name and the backup folder name because I run this job weekly (sometimes more) and I don&#039;t want to hassle with finding the version of the dataset I need.</description>
		<content:encoded><![CDATA[<p>Nice code...very helpful.</p>
<p>As far as other platforms go, your code should work if you change the filepaths (see my comment in your previous posting) and you convert the -winexec- command to -!- or -shell-.  </p>
<p>I have a similar job set up, but with a slightly different purpose. I've got a task set up to periodically convert files copied over from our server using -stcmd-  (above you have just -st-...when I try just -st- Stata doesnt recognize the stat/transfer command (?)).  In a non-windows environment, you should really probably set up a cron job (versus the batch/.bat file used in windows) to perform this kind of periodic work, but I cheat and put the command</p>
<p>     Stata -b do dofile.do</p>
<p>in MacOSX's   "iCal.app"  as an event on the calendar, and tell it to run weekly on Friday at 6pm.</p>
<p>In "dofile.do" I put a loop containing the files to copied and converted using -stcmd-, so something like:</p>
<p>*******<br />
local in //server/serverpath/folder/"<br />
local out "/users/username/folder/"</p>
<p>forvalues n = 1/1000 {<br />
 tokenize `" "file`n'" "newfile`n'" "report`n'" "anotherfile`n'" "'<br />
while "`1'" != "" {<br />
	stcmd  "`in'`1'.csv" "`out'`1'_converted`c(current__date)'.dta"   /y /q /od<br />
        cap mkdir "`in'backup/`c(current_date)'/", public<br />
        copy "`in'`1'.csv"      "`in'backup/`c(current_date)'/`1'.csv", replace public<br />
	mac shift<br />
	}</p>
<p>*********</p>
<p>This should take all 1000 of each of the 4 file types (file, newfile, report, anotherfile) and convert them from .csv to .dta (or whatever file types you want...I just used these as an example here), put them in the new directory (out) with the current date in the folder name,  and then save a copy of the .csv file in the backup directory.    Note that I put the current date in the file name and the backup folder name because I run this job weekly (sometimes more) and I don't want to hassle with finding the version of the dataset I need.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

