- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
I would like to use the following code to read some data from a sas file:
data want;
infile 'd:\temp\x.html' lrecl=20000 dsd dlm='<>';
input @'>' x : $200. @@;
if not missing(x);
run;
Instead of reading the same data from x.html file, I have the following SAS7bDat file under SASUser.x
How do I use the same code here:
data want;
set sasuser.x;
(I have no clue beyond this... plz help)
Your help is greatly appreciated in advance...
Jijil Ramakrishnan
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you to refer to me. Here is :
data have;
infile cards length=len;
input text $varying200. len;
datalines4;
</h1><br/><h2 class="pageTitle entryTitle">test<span class="homograph">1</span></h2>
;;;;
run;
data want;
set have;
re=prxparse('/(?<=>)[^<]+/o');
start = 1;
stop = length(text);
call prxnext(re, start, stop,text, position, length);
do while (position > 0);
found = substr(text, position, length);
output;
call prxnext(re, start, stop, text, position, length);
end;
keep found;
run;
Xia Keshan
Message was edited by: xia keshan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear Jar,
Please post the first few (5?) records from both the html and SAS file.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This is my earlier communication
Hi,
I need help to read one url file into a varible called record.
</h1><br/><h2 class="pageTitle entryTitle">test<span class="homograph">1</span></h2>
/*output:*/
Record
</h1>
<br/>
<h2 class="pageTitle entryTitle">
test
<span class="homograph">
1
</span>
</h2>
Ideally, I want only "test" and "1". If someone can help me to read either the whole items or non-html-tag portion it will be highly appreciated.
Regards,
Jijil
(KSharp had helped me earlier with the code above, thanks to him)
This time, the raw html data is not in an html file, rather it is in sas under 'sasuser'.
Jijil
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you to refer to me. Here is :
data have;
infile cards length=len;
input text $varying200. len;
datalines4;
</h1><br/><h2 class="pageTitle entryTitle">test<span class="homograph">1</span></h2>
;;;;
run;
data want;
set have;
re=prxparse('/(?<=>)[^<]+/o');
start = 1;
stop = length(text);
call prxnext(re, start, stop,text, position, length);
do while (position > 0);
found = substr(text, position, length);
output;
call prxnext(re, start, stop, text, position, length);
end;
keep found;
run;
Xia Keshan
Message was edited by: xia keshan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear KSharp,
Perhaps I had not illustrated my question enough earlier. The solution is much simpler, and if I had asked more claerly all of you could have helped me better:
Instead of accessing to a file(with HTML raw data in it) using infile input, I had to access to a sas dataset:
data Want;
Set have;
before=Record;
rx1=prxparse("s/<.*?>//");
call prxchange(rx1,99,Record);
if Record="" then delete;
Run;
Jijil Ramakrishnan