Statalist


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

st: RE: AW: AW: RE: Check whether ado file is installed


From   "Tharyan, Rajesh" <R.Tharyan@exeter.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: AW: AW: RE: Check whether ado file is installed
Date   Mon, 14 Dec 2009 14:27:52 +0000

Martin .. You are right..I am Sorry.. I think the code should be as follows. Here example1 is the example1.ado file, but you specify it without the extension. You only need the .ado extenson for the findfile command.

local required_ados "example1 example2 " //add the required ados here//
foreach x of local required_ados {
capture findfile `x'.ado		
if _rc==601 {
ssc install `x'
}
} 

Regards
rajesh

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: 14 December 2009 14:18
To: statalist@hsphsun2.harvard.edu
Subject: st: AW: AW: RE: Check whether ado file is installed


<> 

As in 


*************
local required_ados "example1.ado" 

foreach x of local required_ados {
	 findfile `x'.ado
}
*************

which leads to 


file "example1.ado.ado" not found
r(601)


So even if the ado was there, your loop would install anyway...


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Martin Weiss
Gesendet: Montag, 14. Dezember 2009 15:14
An: statalist@hsphsun2.harvard.edu
Betreff: st: AW: RE: Check whether ado file is installed


<> 

Would the ".ado" suffix not appear twice, then, once from the members of the
-local- which are entered into "`x'" in the loop, and once from your manual
addition?


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Tharyan, Rajesh
Gesendet: Montag, 14. Dezember 2009 15:12
An: statalist@hsphsun2.harvard.edu
Betreff: st: RE: Check whether ado file is installed

How about this?

local required_ados " example1.ado example2.ado" //add the required ados
here//
foreach x of local required_ados {
capture findfile `x'.ado		
if _rc==601 {
ssc install `x'

Hope this helps
Rajesh

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jan Sauermann
Sent: 14 December 2009 01:05
To: statalist@hsphsun2.harvard.edu
Subject: st: Check whether ado file is installed

Dear Stata list,

I work on different computers and would Stata to automatically check
whether a number of ado-files is installed on a local machine. My idea
was to write something like

[a command which checks whether one ado-file is installed / or not]
if package!=installed {
    ssc install package
}

My problem is basically to find a command which (1) checks whether an
ado file is installed and (2)  gives me a local as return.

Best regards,

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

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


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


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

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