Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Data manipulation question


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Data manipulation question
Date   Wed, 28 Jul 2004 18:29:12 -0400

Although there are other ways to do this, I think the easiest might be to
create a file with all the codes and then merge...something like this:

clear
set obs 182
gen ccode=_n
sort ccode
save ccodes

insheet using file.csv
sort ccode
merge ccode using ccodes
replace weight=0 if weight==.
drop _merge


By the way, is it just me or does it seem like many recent posts talk about
"Excel" data, but the question has nothing to do with Excel -- they are just
plain old data management questions about using Stata.   Stata does not care
about Excel and, once imported into Stata, it does not matter where it came
from.

Michael Blasnik
[email protected]

----- Original Message ----- 
From: <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 28, 2004 6:16 PM
Subject: Re: st: Data manipulation question


> The thing is, I don't have entries in my excel file for those 'ccode' with
a
> weight of 0(zero)
>
> I have weights for only about 35 out of 182, so I am asking how to
generate the
> remaining 147 without manually having to figure out which 'ccode's are
missing
> and entering them manually.
>
> So if I simply -insheet- and -sort-, I will end up with my original file:
> ccode   weight
> 6               .33
> 10            .036
> 11            .005
>  181           .004
>  182           1
>
> I don't know if this makes more sense now or not.  But is there a way to
find
> out what numbers of the sequence 1-182 are missing?  This is what I am
getting
> at.
>
> Thanks
> Justin


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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