Statalist


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

st: Re: follow up on Stata


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: follow up on Stata
Date   Wed, 8 Oct 2008 23:12:17 +0200

Hello Prashant,

it is very good to hear from you, but you should use the list for any questions so that the whole community can profit from the responses and they get archived and can be dug out by future Stata beginners.

Several commands come to mind, such as -joinby- -merge- -append-, but also -tempfile-s where you can store a dataset temporarily and then do things to it later. But in the absence of a concrete example, it is hard to know what "populating from another dataset" might actually mean. Give me a hands-on sample of your data, and I will do my best to solve your problem...

HTH
Martin
_______________________
----- Original Message ----- From: "Prashant Shukla" <PShukla@globalshares.com>
To: "Martin Weiss" <martin.weiss1@gmx.de>
Sent: Wednesday, October 08, 2008 10:30 PM
Subject: follow up on Stata


Hi Martin,

Thanks so much again for your answers again. I am writing to you
personally as your answers were the most helpful to me. I think you are
doing a great service to all of us Stata users with all your prolific
suggestions. I hope you don't mind me contacting you this way

I just wanted to ask you one more question, for now. Basically, now that
I have all the variables generated and formatted correctly. How can I
map variables from other datasets into this new blank one? For instance,
our new data set has variable "ZIP" that needs to be populated with
"Zipcode" from another data set. How would I do that? Of course, I could
just rename the old dataset and format it the way I want it.

But, I want to write programs that can just develop a dataset for me
where I populate variables from other data sets in any format. I have to
do this a lot, very, very often. I am sure you see how this would be
more efficient in the long run as opposed to dealing with every dataset
individually.

Thank you so much Martin,

-Prash.

-------------------------------------

Welcome and good to see you in the community! On the first question, you
can open as many instances of Stata as your computer allows; or you can
-append- or -merge- datasets. On the second, every time you open an
instance of Stata, "a new dataset" is already there. -generate- as many
variables as you like, -format- them and -save- them in .dta format. If
you want to get file transfers, both in and out of Stata, right fast, I
would recommend investing in Stat/Transfer which is great in combination
with the -ssc describe stcmd- package.
BTW, the red columns are string variables. Stata is not particularly
fond of those, so most of the time you want to -decode- or -destring-
them. After -destring-, they will be highlighted in blue in the Data
Editor and Data Browser. Note that not all strings should be treated
this way, though. If you have a dataset whose 250 rows are populated by
the countries of the earth, you probably should leave the "country"
variable as string...


HTH
Martin


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