Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: RE: st: ado file help


From   Christopher Baum <kit.baum@bc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: RE: st: ado file help
Date   Wed, 15 Aug 2012 13:46:51 +0000

<>
On Aug 15, 2012, at 2:33 AM, Tashi wrote:

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

Stata has no trouble creating new variables within a program, even when there is no data in memory. As others have suggested repeatedly, Read The Effing Manual!  It will save a lot of bandwidth on the list.

. clear

. prog drop _all

. prog tashi
  1. version 12
  2. syntax newvarlist(min=2 max=2) [,OBS(integer 100)]
  3. drawnorm `varlist', n(`obs')
  4. end

end of do-file

. tashi one two
(obs 100)

. desc

Contains data
  obs:           100                          
 vars:             2                          
 size:           800                          
-------------------------------------------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------------------------------------------
one             float  %9.0g                  
two             float  %9.0g                  
-------------------------------------------------------------------------------------------------------------------
Sorted by:  
     Note:  dataset has changed since last saved


Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                             An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
  An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


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