Sunday, March 05, 2006

Re: st: from labels to variables

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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?