{"id":55,"date":"2013-09-26T16:51:04","date_gmt":"2013-09-26T16:51:04","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/icsf\/?page_id=55"},"modified":"2026-01-27T11:11:55","modified_gmt":"2026-01-27T11:11:55","slug":"stata","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/software\/applications\/stata\/","title":{"rendered":"Stata"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Stata is a general-purpose statistical software package. Versions 11, 12, 13, 13.1, 14.1, 16, 17, 18, 19.5 are installed on the iCSF.<\/p>\n<h2>Restrictions on Use<\/h2>\n<p>Only those users who are part of a licensed group may access this software(further details below). Access to the software is restricted by Unix groups.<\/p>\n<p>All users must abide by the <a href=\"http:\/\/www.stata.com\/order\/end-user-license-agreement\">Latest Stata license agreement (applies for all versions)<\/a>.<br \/>\nShould this link expire, please let us know via our <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/overview\/help\/\">help form<\/a>.<br \/>\nImportant points to note are:<\/p>\n<ul>\n<li>Only staff and students of The University of Manchester are permitted to use the software.<\/li>\n<li>Usage only for academic work is permitted. Usage for commercial work including commercially funded grants is not permitted<\/li>\n<\/ul>\n<h2>Set up procedure<\/h2>\n<p>Load one of the following modulefiles below according to which group you are in:<\/p>\n<ul>\n<li><strong>Faculty of BMH<\/strong> inc. IPH users. To request access please contact us via our <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/hpc-help\">form<\/a>.\n<pre>\r\n#### BMH users who have been given stata access will use v19.5 ####\r\nmodule load apps\/binapps\/stata\/19-bmh           # (<strong>version 19.5<\/strong> available from 2026-Jan)\r\n<\/pre>\n<p><strong>Please note<\/strong>: due to license restrictions the parallel version of Stata 19.5 (<code>stata-mp<\/code> and <code>xstata-mp<\/code>) is limited to 4-cores per Stata process.<\/p>\n<li><strong>Institute of Population Health (IPH).<\/strong> To request access please contact license holder <a href=\"&#x6d;&#x61;&#105;lt&#x6f;&#x3a;&#69;&#46;K&#x6f;&#x6e;&#116;&#111;p&#x61;&#x6e;&#x74;&#101;li&#x73;&#x40;&#109;&#97;n&#x63;&#x68;&#101;&#115;t&#x65;&#x72;&#46;&#97;c&#x2e;&#x75;&#x6b;\"> Evan Kontopantelis<\/a> (install does not grant access to iCSF, must be part of a contributing group)\n<pre>\r\n#### Most IPH users who have been given stata access will use v17 ####\r\nmodule load apps\/binapps\/stata\/17-iph           # (<strong>version 17.0<\/strong> available from 2022-Apr)\r\n\r\n#### Not everybody in IPH has access to v18 ####\r\n# Original April version of v18\r\nmodule load apps\/binapps\/stata\/18-iph-230418    # (<strong>version 18.0<\/strong> available from 2023-April)\r\n# <strong>New June update of v18<\/strong>\r\nmodule load apps\/binapps\/stata\/18-iph           # (<strong>version 18.0<\/strong> available from 2023-June)\r\n<\/pre>\n<p><strong>Please note<\/strong>: due to license restrictions <strong>Stata 16 is no longer available<\/strong>.<br \/>\nHowever, Stata is fully backward compatible.<br \/>\nAll you have to do is run a later version and add <code>version 16<\/code> at the top of your script.<br \/>\nSee <a href=\"https:\/\/www.stata.com\/manuals\/pversion.pdf\"> https:\/\/www.stata.com\/manuals\/pversion.pdf<\/a>\n<\/li>\n<li><strong>Humanities and AMBS<\/strong>. To request access please contact us via our <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/hpc-help\">form<\/a>.\n<pre># Latest version\r\nmodule load apps\/binapps\/stata\/14-170504 \r\n<\/pre>\n<\/li>\n<li><strong>Prof. Jane Worthington&#8217;s group.<\/strong> To request access please contact us via our <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/hpc-help\">form<\/a>.\n<pre># Latest version\r\nmodule load apps\/binapps\/stata\/13-jw01\r\nmodule load apps\/binapps\/stata\/13-jw01-singularity   # This version addresses some rendering issues in the GUI\r\n<\/pre>\n<\/li>\n<\/ul>\n<h2>Running the application<\/h2>\n<p>Several versions of stata are available. Having loaded the appropriate modulefile simply run one of the following:<\/p>\n<ul>\n<li>The stata GUI version:\n<pre>xstata &amp;              # IC version (standard, medium data)\r\nxstata-sm &amp;           # SM verison (small data)\r\nxstata-se &amp;           # SE version (single core, big data)\r\nxstata-mp &amp;           # MP version (multicore, big data)  #<strong>v19.5 limited to 4-cores<\/strong>\r\n<\/pre>\n<p>The <code>&amp;<\/code> returns your iCSF prompt to you so that you can use the stata GUI and the iCSF command line at the same time. For example, you may wish to copy some files or look around your home directory to check where your files area.<\/li>\n<li>The stata command-line version:\n<pre>stata               # IC version (standard, medium data)\r\nstata-sm            # SM verison (small data)\r\nstata-se            # SE version (single core, big data)\r\nstata-mp            # MP version (multicore, big data) #<strong>v19.5 limited to 4-cores<\/strong>\r\n<\/pre>\n<\/li>\n<\/ul>\n<p>Full information on the differences between these versions (e.g., number of variables they can process, size of data) is available at <a href=\"http:\/\/www.stata.com\/manuals13\/u5.pdf\">http:\/\/www.stata.com\/manuals13\/u5.pdf<\/a>.<\/p>\n<h3>Number of Cores and stata-mp<\/h3>\n<p>Apart from Stata 19.5 which is limited to 4-cores per process. The multicore versions of stata (<code>stata-mp<\/code> and <code>xstata-mp<\/code>) will try to use all cores on the iCSF compute node where you are running, by default. iCSF nodes often have several users running applications on them. Hence the MP version may be trying to use cores in use by other users. If this happens you may not get the performance you are expecting.<\/p>\n<p>To set the number of cores used by stata, run the following command in stata:<\/p>\n<pre>set processors 4           \/\/ 4 cores for example\r\n<\/pre>\n<p>To obtain help about this command, run:<\/p>\n<pre>help set_processors        \/\/ notice the _ in the help version of the command\r\n<\/pre>\n<h3>Memory Considerations<\/h3>\n<p>We highly recommend you read the short section in the Stata manual on <a href=\"https:\/\/www.stata.com\/manuals\/u6.pdf\">Managing Memory<\/a> (pdf). This contains a few commands that can help if you are running out of memory or if Stata is reporting that no more variables can be added.<\/p>\n<p>For example, use the following command to compress your data.<\/p>\n<pre>compress<\/pre>\n<p>To see how much memory Stata is using (run it after loading your dataset), run the following command:<\/p>\n<pre>\r\n# Show memory usage stats\r\nmemory\r\n\r\n# Show memory settings\r\nquery memory\r\n\r\n# Restrict stata's memory usage\r\nset max_memory 100g\r\n<\/pre>\n<p>As we are running on Linux, <a href=\"https:\/\/www.stata.com\/manuals\/dmemory.pdf#dmemoryRemarksandexamplesSeriousbuginLinuxOS\">another section of the manual recommends<\/a> (pdf) that you use the <code>set max_memory<\/code> command, for example <code>set max_memory 100g<\/code>, to set the point at which Stata will begin to use disk as extra memory space, rather than trying to allocate more and more RAM on the compute node. The problem with trying to allocate more and more RAM is that if the memory has been used up (by you and other users on the iCSF node you are running on) then Stata may well simply crash if it fails to get any more memory. The <code>max memory<\/code> command will try to avoid this point being reached.<\/p>\n<h3>Recovering the .do file after a crash<\/h3>\n<p>We have had reports that if stata crashes, it leaves you with a zero-sized .do file!<\/p>\n<p>If this happens, and your .do file is stored in your iCSF <em>home<\/em> directory, or any additional Research Data Storage you might have access to (e.g. <code>\/mnt\/bmh01-rds\/<em>NAME_PROJECT<\/em>\/<\/code>), you can recover a previous version of the file from the storage backups, as follows:<\/p>\n<pre>\r\n# Go to where the .do file was - EG: your home or RDS\r\ncd ~\/my_stata_work\r\ncd \/mnt\/<em>fac<\/em>01-rds\/<em>PROJ<\/em>\/\r\n\r\n# Go into the special .snapshot dir\r\ncd .snapshot\r\n\r\n# There are hourly and daily backup directories. Let's look for the .do file.\r\n# The most recent backups will be at the bottom of the list. They might have\r\n# a zero size. So look for the most recent that isn't zero\r\nls -ltr *\/work.do\r\n    #\r\n    # Lowercase letter L\r\n\r\n-rw-r--r-- 1 mabcxyz1 bmh01-project 2576 Aug  8  2024 Reynolds_BMH_NFS_24hr_2025-03-26_16-30-00\/work.do\r\n-rw-r--r-- 1 mabcxyz1 bmh01-project <strong>2576<\/strong> Aug  8  <strong>2024 Reynolds_BMH_NFS_24hr_2025-03-26_15-30-00\/work.do<\/strong>\r\n-rw-r--r-- 1 mabcxyz1 bmh01-project 0    Aug  8  2024 Reynolds_BMH_NFS_24hr_2025-03-26_14-30-00\/work.do\r\n-rw-r--r-- 1 mabcxyz1 bmh01-project 0    Aug  8  2024 Reynolds_BMH_NFS_24hr_2025-03-26_13-30-00\/work.do\r\n-rw-r--r-- 1 mabcxyz1 bmh01-project 0    Aug  8  2024 Reynolds_BMH_NFS_24hr_2025-03-26_12-30-00\/work.do\r\n-rw-r--r-- 1 mabcxyz1 bmh01-project 0    Aug  8  2024 Index-Snapshot-Current-1743012023\/work.do\r\n                                    #\r\n                                    # Size:\r\n                                    # Recent backups might be zero in size if they've backed up\r\n                                    # the file that stata trashed. Look for the first file that\r\n                                    # isn't zero - <strong>2576<\/strong> bytes in this example.\r\n\r\n# Recover the non-zero file. The \"..\" means \"up a level\" - i.e., out of the .snapshot area.\r\nrsync -av <strong>2024 Reynolds_BMH_NFS_24hr_2025-03-26_15-30-00\/work.do<\/strong> ..\r\n\r\n# Now check your file - does it contain what you expect?\r\ncd ..\r\nless work.do\r\n<\/pre>\n<h3>Exiting Stata<\/h3>\n<p>To exit the stata command shell type:<\/p>\n<pre>exit\r\n<\/pre>\n<h2>Installing Modules with ssc<\/h2>\n<div class=\"note\">The University proxy is no longer available. You should REMOVE any proxy config from your stata config &#8211; see below.<\/p>\n<p>If you can then no longer download Stata modules, please tell us the address of the remote host where your download is coming from.<\/p><\/div>\n<p>Additional stata packages\/modules can be installed using the <code>ssc<\/code> command in stata. If you&#8217;ve previously configured stata to use the University proxy, you&#8217;ll need to REMOVE that config, as follows:<\/p>\n<ol>\n<li>Start the graphical version of stata using:\n<pre>xstata<\/pre>\n<\/li>\n<li>Select the menus: <em>Edit-&gt;Preferences-&gt;General Preferences<\/em><\/li>\n<li>Select <em>Internet<\/em> in the list on the left hand side<\/li>\n<li><strong>UNTICK<\/strong> <em>Connect through a proxy server<\/em> <del datetime=\"2024-07-04T12:13:54+00:00\">and make the following settings:<\/del><\/li>\n<li><del datetime=\"2024-07-04T12:13:28+00:00\">HTTP Server: <code>proxy.man.ac.uk<\/code><\/del> &#8211; <strong>THIS SHOULD NO LONGER BE USED<\/strong><\/li>\n<li><del datetime=\"2024-07-04T12:13:28+00:00\">Port: <code>3128<\/code><\/del> <strong>THIS SHOULD NO LONGER BE USED<\/strong><\/li>\n<\/ol>\n<p>You should then be able to run the <code>ssc install<\/code> command in the stata GUI. For example to install the <em>parmest<\/em> package:<\/p>\n<pre>\r\n. ssc install parmest\r\n<\/pre>\n<p>Stata should report it is downloading the file and installing. <strong>If Stata fails to download<\/strong>, please send us all output from the <code>ssc<\/code> command &#8211; we will need to add the remote hostname from where Stata is trying to download your module to an allow-list.<\/p>\n<h2>Further information<\/h2>\n<ul>\n<li><a href=\"http:\/\/www.stata.com\/bookstore\/users-guide\/\">Stata Online Documentation<\/a>. In particular, please see the section on <a href=\"https:\/\/www.stata.com\/manuals\/u6.pdf\">Managing Memory (pdf)<\/a>.<\/li>\n<li>List of Stata online <a href=\"http:\/\/www.stata.com\/links\/resources-for-learning-stata\/\">Resources for learning Stata<\/a>.<\/li>\n<li>Stata <a href=\"https:\/\/www.stata.com\/bookstore\/statacheatsheets.pdf\">Cheat Sheets<\/a> (pdf). <strong>HIGHLY RECOMMENDED<\/strong><\/li>\n<\/ul>\n<h2>Updates<\/h2>\n<p><strong>2018-Feb-06<\/strong> Stata 14 for iph no longer available (for ref only the modulefile names were apps\/binapps\/stata\/14-iph and apps\/binapps\/stata\/14-iph-160128)<\/p>\n<p>2020-Apr Stata 15 for iph no longer available (for ref only the modulefile names were apps\/binapps\/stata\/15-iph )<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Stata is a general-purpose statistical software package. Versions 11, 12, 13, 13.1, 14.1, 16, 17, 18, 19.5 are installed on the iCSF. Restrictions on Use Only those users who are part of a licensed group may access this software(further details below). Access to the software is restricted by Unix groups. All users must abide by the Latest Stata license agreement (applies for all versions). Should this link expire, please let us know via our.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/software\/applications\/stata\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":43,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-55","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/pages\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":24,"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/pages\/55\/revisions"}],"predecessor-version":[{"id":1544,"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/pages\/55\/revisions\/1544"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/pages\/43"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/icsf\/wp-json\/wp\/v2\/media?parent=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}