[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: executing stata commands/programs based on filename or content
I am new to writing programs. I would like to ask for advise on a
program for standardising our lab reports using stata.
The bottom line is I would like to type in 1 common identifier , in this
case the experiment number (exptno) that is present in the filename and
the program does the rest, depending on the suffix of the files it
I am at the stage that I have to type
pgmname exptnodis.csv, exptnorn.csv, and exptnores.csv
assigning each file to a macro 1-3.
I want to get to the stage where I type:
will create three different graphs using the files exptnorn.csv,
exptnodis.csv, and exptnores.csv and combine them
I am using a quantiative PCR machine in the laboratory and for each
experiment, I generate three comma separated files. Each file is
identified by the experiment number and an identifier that I type in
from the lab machine.
Thus, I would have for experiment RQ01, the following files:
Each file is used for a specific graph. To create the graph requires
reshaping and creating a few new variables.
I currently have a program that i called called qpcr that will work such
qpcr rq01rn.csv rq01dis.csv rq01res.csv
will create three different graphs and save them accordingly.
I have written a do file to combine the three graphs but this still
requires me to type in each graph name withine the do file - or I could
write a program, but it would be similar to the one above and would
require me to write three different .gph names after the program name
I want to improve on this so that I only need to type
qpcr exptname or in this instance, qpcr rq01
1. to create three separate graphs from three different files coming
from experiment rq01; and
2. to combine them
I am unsure as to how to proceed next.
I thought that my first hurdle would be to get stata to execute three
separate commands based on a common identifier (in this case exptname)
but each command is to be run on different files, with each file bearing
the exptname but differing in its suffix.
I thought that the simplest way to do this was to ask Stata to read the
file names of the files that begin with rq01 and to run the appropriate
graph command that I have written based on the differing suffixes (one
graph for rn, one for dis, one for res).
I was then hoping to use the same solution to go on to the next step
which is to combine three different graphs bearing a common experiment
name but differing in it suffix to be incorporated into the program
What is the best way to proceed?
I would appreciate any suggestions.
Dr. Juan Antonio Solon
MRC Keneba Field Station
MRC Laboratories Gambia
Atlantic Road, Fajara
PO Box 273, Banjul
Email : firstname.lastname@example.org
Tel No: (++220) 541021
Fax No: (++220) 541022 / (++220) 496513
* For searches and help try: