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: use of tempfile

From   Prakash Singh <>
Subject   Re: st: use of tempfile
Date   Thu, 19 Apr 2012 21:23:40 +0530

In the "before" data set I have list of variable say "n", now out of
these n variables some variable are so kept in the data set that for
each state_code they represent sales, export value of certain
industry. My interest here to transform the data set in such a way
that these sales and export value for the particular industry as
separate variables. to put other way around I want to make my data
free from state_code.

so if the name of the data file is sales1.dta (before)

Then using keep if command and renaming the numbers in  state_code and
other variable I have created data file assigning number identical to
the category of state_code. the state_code variable is having 20
different values (category) and that's how I have sales1_1.dta to
sales1_20.dta after use of keep if command. Now I have to merge these
20 newly created data set from "before" situation to get one final
data set let us call it sales1_1_20.dta "after" situation so that
sales, export of different industry will come beside each other as
separate variable in one data file. common_id is the variable being
able to uniquely identify the observation is sued to merge.

I could write the code but it gives me unnecessary data file which I
will not be using in analysis ( all other created data file baring
sales1_1_20.dta). One obvious answer is that I can delete them once I
have the final data file but then I thought there could some way using
that I can bypass save command and that is the reason I have put
tempfile as the subject of my query thread.

*   For searches and help try:

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