Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: RE: importing html to stata -

From   Nick Cox <>
To   Nick Cox <>, "''" <>
Subject   st: RE: importing html to stata -
Date   Thu, 8 Dec 2011 13:11:58 +0000

Followed by 

gen var1 = word(text, 1) 
gen var2 = subinstr(text, word(text, 1), "", 1) 


-----Original Message-----
From: Nick Cox 
Sent: 08 December 2011 13:07
To: ''
Subject: RE: importing html to stata -

This seemed to work for me. It took a few iterations. 

infile str244 text using, clear 
drop in 1/39
drop in 20827/L
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


-----Original Message-----
From: [] On Behalf Of Lars Folkestad
Sent: 08 December 2011 12:42
Subject: st: importing html to stata -

Dear List

I would like to download the following html into stata:
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
I've tried searching the list, and found one example:
But i must admit i did not understand what that was all about, and i dont
think it applies to my problem.

Thank you


*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index