FILENAME test URL "http://www.indeed.com/jobs?q=sas+programmer&limit=100&fromage=0&start=0" DEBUG LRECL=700;
DATA test;
infile test length=len;
input record $varying700. len;
*****DELETE MOST LINES W/O JOB;
if index(record, 'cmpid')=0 then delete;
*****DELETE HEAD ADVERSTISEMENT;
if index(record, 'jobmap')=0 then delete;
run;
data test2 ;
set test;
format zip z5.;
length state $2.;
*****SET UP ROAD SIGNS;
id1=index(record, 'srcname');
id2=index(record, 'cmpesc');
id3=index(record, 'cmplnk');
id4=index(record, 'loc');
id5=index(record, 'lat');
id6=index(record, 'lon');
id7=index(record, 'country');
id8=index(record, 'zip');
id9=index(record, 'state');
id10=index(record, 'city');
id11=index(record, 'title');
id12=index(record, 'locid');
*****OUPUT VARIABLES ;
source=substr(record, id1+9, id2-id1-11);
company=substr(record, id2+8, id3-id2-10); if company= 'na' or substr(company,1,1)="'" then company='N/A';
loc=substr(record, id4+5, id5-id4-7);
country=substr(record, id7+9, id8-id7-11);
if id8+5=id9-id8-7 then zip=.; else zip=substr(record, id8+5, id9-id8-7);
state=substr(record, id9+7, id10-id9-9); if state= 'na' or substr(state,1,1)="'" then state=.;
city=substr(record, id10+6, id11-id10-8); if city= 'na' or substr(city,1,1)="'" then city=.;
title=substr(record, id11+7, id12-id11-9);
drop record id1-id12;
index=_n_;
;
run;
ods rtf file='d:\sas.rtf';
proc sort data=test2 out=test3;
by state city;
run;
proc print data=test3;
var index title company state city source;
title "SAS programmer opens on &sysday, &sysdate ";
title2 "Collected by &SYSTIME ";
footnote "Created by Charlie Huang";
run;
ods rtf close;