Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm |

Date |
Thu, 8 Dec 2011 13:27:30 +0000 |

No, not directly. You can only attach value labels to integers, remember. But the best way you can do something similar is likely to be with a -merge-. Nick n.j.cox@durham.ac.uk Lars Folkestad Thank you Nick, that worked fantastic. Is it possible to use this newly created dta file as a value label for another data set, so that if fx in my other data set i have a patient with the diagnosis 000.0 which is essential cholera, the essential cholera will show up as a value label? lars Den 08/12/11 14.11 skrev "Nick Cox" <n.j.cox@durham.ac.uk>: >Followed by > >gen var1 = word(text, 1) >gen var2 = subinstr(text, word(text, 1), "", 1) > > >Nick >n.j.cox@durham.ac.uk > > >-----Original Message----- >From: Nick Cox >Sent: 08 December 2011 13:07 >To: 'statalist@hsphsun2.harvard.edu' >Subject: RE: importing html to stata - >http://www.wolfbane.com/icd/icd8h.htm > >This seemed to work for me. It took a few iterations. > >infile str244 text using http://www.wolfbane.com/icd/icd8h.htm, clear >drop in 1/39 >drop in 20827/L >compress >gen entry = regexm(text, "^\(*[0-9]") >replace entry = regexm(text, "^\([E|N|Y][0-9]") if entry == 0 >replace entry = regexm(text, "^[E|N|Y][0-9]") if entry == 0 >replace entry = sum(entry) >replace text = text[_n-1] + " " + text if entry == entry[_n-1] >sort entry, stable >by entry : keep if _n == _N >drop entry > >Nick >n.j.cox@durham.ac.uk > > >-----Original Message----- >From: owner-statalist@hsphsun2.harvard.edu >[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lars Folkestad >Sent: 08 December 2011 12:42 >To: statalist@hsphsun2.harvard.edu >Subject: st: importing html to stata - >http://www.wolfbane.com/icd/icd8h.htm > >Dear List > >I would like to download the following html into stata: >http://www.wolfbane.com/icd/icd8h.htm >I would like to make the numbers from 000 - _n be var1 and the text from >cholera to be var2 > >Can this be done through stata or do i need to go via a program of some >sort. >I've tried searching the list, and found one example: >http://www.stata.com/statalist/archive/2007-03/msg00535.html >But i must admit i did not understand what that was all about, and i dont >think it applies to my problem. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm***From:*Lars Folkestad <lfolkestad@health.sdu.dk>

**References**:**st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm***From:*Lars Folkestad <lfolkestad@health.sdu.dk>

- Prev by Date:
**Re: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm** - Next by Date:
**Re: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm** - Previous by thread:
**Re: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm** - Next by thread:
**Re: st: RE: importing html to stata - http://www.wolfbane.com/icd/icd8h.htm** - Index(es):