Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: ado file help

From   daniel klein <>
Subject   Re: st: ado file help
Date   Tue, 14 Aug 2012 17:45:59 +0200


-syntax- does not look backwards, but offers a convenient way to check
whether what the user specifies are actually valid variable names in
the current dataset. That does not suck at all, once you understand
it. Feel free to specifiy -namelist- instead of -varlist- and do the
checking "by hand" later on, e.g.

pr dd
    vers 12.1
    syntax [namelist] , STARTdate(str) ENDdate(str) BROKERid(numeric)

    <load the data>

    if ("`namelist'" == "") loc namelist _all
    cap unab varlist : `namelist'
    if (_rc) {
        <do whatever you want to do, if namelist contains invalid
variable names>
    else {
        <do whatever you want to do if namlist conatains all valid
variable names>


in this code, 2 variables are created namely var1 and var2. So, I want
to create a dataset using syntax options, which I did.  I would also
like to have the flexibility of drawing graphs of the variables I want
( say for example tsline var1 or var2 or both)  or list the
variables(say for example list var2 or var2 or both )  for that
matter. What really sucks is syntax's limitation to only look
backward. As I said, I could have syntax statement after creating
dataset( and I am sure that wouldn't be that hard) but for this
particular example, I need to define it before to create datasets on
first place.

Note: I am very careful to not use any abbreviation while posting ):
example for eg.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index