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

Re: st: Simple questions regarding time series data

From   Ulrich Kohler <>
Subject   Re: st: Simple questions regarding time series data
Date   Fri, 17 Jul 2009 09:09:42 +0200

Others might be better prepared for answering your question 1. Meanwhile
I have answers to the others:

Am Freitag, den 17.07.2009, 10:17 +0800 schrieb Shruthi JAYARAM:
> I have a few very simple questions regarding time series data manipulation
> - I'm relatively new to STATA (was using R before) and couldn't locate the
> answers in the help manual.


> 2. Is it possible to concatenate strings and numbers into a larger string?
> For example, I have a variable y and I want to get the output "The
> forecasted GDP for 2009 is y". Can I write a command that intuitively
> carries out this: gen outputstring = paste("The forecast GDP for 2009 is",
> y)

. gen outputstring = "The forcast GDP for 2009 is " + string(y)

see -help operators- and -help string functions-.

> 3. If I have a time variable x that runs from 1990m1 to 1990m12, how do I
> extract the first observation? In R, variables are arrays or matrices,
> allowing you to specify the particular observation you would need, such as
> x[1] for the first observation of x. What is the equivalent in STATA?

It is just the same:

. display x[1]

displays the frist value in variable x. You can also put expressions
inside the brackets:

. display x[int(_N/2)+1)]

See -help exp- for what Stata (not: STATA) means by "expression".

> 4. Finally, is it possible to invoke the system command line from within
> STATA to run an outside program during the STATA proceses?


. help shell

Hope this helps


030 25491-361

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index