%let name=mc3b; filename odsout '.'; %let mc3path=\\l72586.na.sas.com\public\VAST_2011\MC_3_Materials_4_4_2011\; libname mydata "&mc3path"; data threats; set mydata.vastopolis_news; where title?'Convicts Escape' or story?'Convicts Escape' or title?'Shootout' or story?'Shootout' or title?'nuclear weapons' or story?'nuclear weapons' or title?'Animal Deaths' or story?'Animal Deaths' or title?'Terrorism' or story?'terrorism' or title?'Hacker' or story?'hacker' or title?'Arson' or story?'arson' or title?'Money Laundering' or story?'money laundering' or title?'Computer Hack' or story?'computer hack' or title?'Terrorist' or story?'terrorist' or title?'Homeland Security' or story?'Homeland Security' or title?'Flu Patients' or story?'flu patients' or title?' Flu ' or story?' flu ' or story?' flu,' or story?'Margarita Verdin' or story?' illness' or story?' epidemic' or story?' the plague' or story?' plague symptoms' or title?'Walked Out' or story?'walked out' or title?'Bomb Makers' or story?'explosive devices' or title?'Dangerous Microbes' or story?'bioterrorism' or title?'Bioterrorism' or story?'Center for Disease Control' or title?'Mass Animal Deaths' or story?'Mass deaths' or title?'Weapons Missing' or story?'weapons missing' or title?'Mad Hacker' or story?'mad hacker' or title?'Brain Tumors' or story?'brain tumors' or story?'radical group' or story?'Edward Patino' or title? 'Nuclear Plant' or story?'nuclear power plant' or story?'Transportation Safety Administration' or story?'dirty bomb' or story?'dead fish' or story?'work of some group' or story?'Federal Bureau of Investigation' or story?'bomb squad' or story?'bomb threat' or story?'Anarchists for Freedom' or story?'Psychobrotherhood' or story?'Paramurderers of Chaos' or story?'Network of Dread' or story?'Jose Thom' ; run; proc sql; create table summary as select *, 1 as count from threats group by date; select count(*) into :count separated by ' ' from summary; select min(date) into :mindate separated by ' ' from summary; select max(date) into :maxdate separated by ' ' from summary; quit; run; data summary; set summary; length myhtml $1000; myhtml='title='||quote(put(date,date9.)||': '||trim(left(title)))|| ' href='||quote('#_'||put(date,date9.)); run; data filler; do date = &mindate to &maxdate by 1; output; end; run; proc sql; create table summary as select filler.*, summary.* from filler left join summary on filler.date = summary.date; quit; run; data summary; set summary; format date date9.; month=month(date); day=day(date); if count=. then count=.001; run; proc sort data=summary out=summary; by date; run; goptions device=png; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" style=sasweb; goptions gunit=pct htitle=4.0 htext=2.5 ftitle="arial/bold" ftext="arial"; axis1 label=none minor=none; axis2 value=(height=1.8 angle=90); pattern1 v=solid c=cxF08080 repeat=1000; title1 ls=1.5 "Possible 'Threat' Articles about Vastopolis"; title2 "Each Bar Represents Daily Count"; title3 "Total Threat Articles = &count"; proc gchart data=summary; format date date5.; vbar day / discrete type=sum sumvar=count group=month nozero subgroup=title nolegend raxis=axis1 maxis=axis2 html=myhtml des='' name="&name"; run; /* date title story */ /* title; proc print data=threats noobs; var date title story; run; */ %macro do_table(date); ods html anchor="_&date"; data tempdata; set threats (where=(date="&date"d)); run; title "Possible Threats : &date"; options nocenter nobyline; proc print data=tempdata noobs; var title story; run; %mend do_table; /* Loop through, and make a plot for each manufacturer */ proc sql noprint; create table loopdata as select unique date from threats; quit; run; data _null_; set loopdata; call execute('%do_table('|| put(date,date9.) ||');'); run; quit; ODS HTML CLOSE; ODS LISTING;