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

Re: st: Data manipulation question


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: Data manipulation question
Date   Wed, 28 Jul 2004 23:09:06 +0100 (BST)

Justin Dubas wrote:

> I have an excel file that looks something like this:
> ccode   weight
> 6               .33
> 10            .036
> 11            .005
> 181           .004
> 182           1
>
> What I need to do is have ccode from 1 to 182, and weight to be 0(zero) if
> there
> is not already a value in my excel file.  So, I hope to have something
> like
> this in the end:
>
> ccode   weight
> 1          0.00
> 2          0.00
> etc.
> 6          .33
> 7          0.00
> etc.
> 182         1
>
> Any suggestion?

Unless I've missed something, it looks like a simple -insheet- and -sort-
job to me; thus:

. insheet using file.csv

assuming that your Excel file is ready for conversion, and all the
information on weights are correct for each case. Then

. sort ccode

I hope that helps.

CLIVE NICHOLAS        |t: 0(044)191 222 5969
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps
*
*   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