Stata

From FarmShare

(Difference between revisions)
Jump to: navigation, search
Line 64: Line 64:
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
  167221 0.00000 script2.su chekh        qw    04/27/2012 15:21:30                                    1         
  167221 0.00000 script2.su chekh        qw    04/27/2012 15:21:30                                    1         
-
[chekh@barley02.stanford.edu] /mnt/glusterfs/chekh [0]
+
...
-
$ cat test
+
...
-
test.do                test.stata.script      test.stata.script.o55  test2.log
+
-
test.log              test.stata.script.e55  test2.do              test_cases/
+
[chekh@barley02.stanford.edu] /mnt/glusterfs/chekh [0]  
[chekh@barley02.stanford.edu] /mnt/glusterfs/chekh [0]  
$ cat test.log  
$ cat test.log  

Revision as of 15:28, 27 April 2012

Running stata in batch mode on the barleys:

[chekh@corn-image-new.stanford.edu] /mnt/glusterfs/chekh [0] 
$ cat test.do 
clear
sysuse auto
describe
[chekh@corn-image-new.stanford.edu] /mnt/glusterfs/chekh [0] 
$ echo "/usr/sweet/bin/stata -b do test2.do" | qsub -cwd -l hostname=barley05 
Your job 5725 ("STDIN") has been submitted
[chekh@corn-image-new.stanford.edu] /mnt/glusterfs/chekh [0] 
$ ls -ltr |tail -n 4
-rw-r--r-- 1 chekh root      27 Nov  7 17:27 test2.do
-rw-r--r-- 1 chekh root       0 Nov  7 17:28 STDIN.o5725
-rw-r--r-- 1 chekh root       0 Nov  7 17:28 STDIN.e5725
-rw-r--r-- 1 chekh root    2400 Nov  7 17:28 test2.log

Looks like stata doesn't print anything to stdin or stderr, but does create a .log file with the same name as your .do file.


using module

We're trying to move away from /usr/sweet/bin, using modules instead. So your stata session looks more like:

[chekh@barley02.stanford.edu] /mnt/glusterfs [130] 
$ source /mnt/glusterfs/software/free/modules/tcl/init/bash
+(0):WARN:0: Directory '/afs/ir/users/c/h/chekh/.modules' not found
[chekh@barley02.stanford.edu] /mnt/glusterfs [0] 
$ module avail
--------------------- /mnt/glusterfs/software/free/modules/tcl/modulefiles ---------------------
MATLAB-R2009b     MATLAB-R2011b     R-2.15.0          StatTransfer-11.2 StataSE-12.1      
MATLAB-R2010b     MATLAB-R2012a     StatTransfer-10.1 StataMP-12.1      
------------------------------------------- Aliases --------------------------------------------
------------------------------------------- Versions -------------------------------------------
[chekh@barley02.stanford.edu] /mnt/glusterfs [0] 
$ module load StataSE-12.1
[chekh@barley02.stanford.edu] /mnt/glusterfs [0] 
$ stata 
...

But that also means you need to modify your job script to point to the right MATLAB. So you'll want to add that "module load" command to that job script.


Job script:

#!/bin/bash
source /mnt/glusterfs/software/free/modules/tcl/init/bash
module load StataSE-12.1
stata -b do test

Full session:


[chekh@barley02.stanford.edu] /mnt/glusterfs/chekh [0] 
$ qsub -cwd -l mem_free=10M script2.submit 
Your job 167221 ("script2.submit") has been submitted
[chekh@barley02.stanford.edu] /mnt/glusterfs/chekh [0] 
$ qstat
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
 167221 0.00000 script2.su chekh        qw    04/27/2012 15:21:30                                    1        
...
...
[chekh@barley02.stanford.edu] /mnt/glusterfs/chekh [0] 
$ cat test.log 

  ___  ____  ____  ____  ____ (R)
 /__    /   ____/   /   ____/
___/   /   /___/   /   /___/   12.1   Copyright 1985-2011 StataCorp LP
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
                                      College Station, Texas 77845 USA
                                      800-STATA-PC        http://www.stata.com
                                      979-696-4600        stata@stata.com
                                      979-696-4601 (fax)

23-user Stata network perpetual license:
       Serial number:  40120564988
         Licensed to:  Jane Tansuwan
                       Stanford University

Notes:
      1.  Command line editing disabled
      2.  Stata running in batch mode

Note:  Your site can add messages to the introduction by editing the file
       stata.msg in the directory where Stata is installed.

. do test 

. clear

. sysuse auto
(1978 Automobile Data)

. describe

Contains data from /mnt/glusterfs/software/non-free/stata-se-12/ado/base/a/auto
> .dta
  obs:            74                          1978 Automobile Data
 vars:            12                          13 Apr 2011 17:45
 size:         3,182                          (_dta has notes)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
make            str18  %-18s                  Make and Model
price           int    %8.0gc                 Price
mpg             int    %8.0g                  Mileage (mpg)
rep78           int    %8.0g                  Repair Record 1978
headroom        float  %6.1f                  Headroom (in.)
trunk           int    %8.0g                  Trunk space (cu. ft.)
weight          int    %8.0gc                 Weight (lbs.)
length          int    %8.0g                  Length (in.)
turn            int    %8.0g                  Turn Circle (ft.)
displacement    int    %8.0g                  Displacement (cu. in.)
gear_ratio      float  %6.2f                  Gear Ratio
foreign         byte   %8.0g       origin     Car type
-------------------------------------------------------------------------------
Sorted by:  foreign

. 
end of do-file
Personal tools
Toolbox
LANGUAGES