Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: from labels to variables


From   Ronnie Babigumira <[email protected]>
To   [email protected]
Subject   Re: st: from labels to variables
Date   Sun, 05 Mar 2006 11:18:28 +0100

When you say you want to turn them into variables, I am guessing, you want the saveval of each cropid

Here is one way (and there may be neater ways)

input hhid cropid saleval
1 101 2000
1 102 3000
1 103 1000
2 101 200
3 102 1300
3 103 1500
end

.reshape wide saleval, i(hhid) j(cropid)
.list

hhid   sale~101   sale~102   sale~103
1       2000       3000       1000
2        200          .          .
3          .       1300       1500

If you really must have the new variables as cropid101 etc, you can use -renpfix- to change the prefix from saleval to
cropid

.renpfix saleval cropid

Ronnie




Fanwell Kenala Bokosi wrote:
Austin,

Thank you for your comments. What I want is to turn them into variables cropid 101, cropid102, etc. I will check the reshape help.

Regards


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

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