An Analysis on Danish Micro Data - School of Economics and ...
An Analysis on Danish Micro Data - School of Economics and ...
An Analysis on Danish Micro Data - School of Economics and ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
if Last.aar then output;<br />
/*output <strong>on</strong>ly the last <strong>of</strong> each BY group*/<br />
data ud.lmdbmtx2;<br />
set sumf;<br />
by udtrnr;<br />
/*c<strong>on</strong>structing a dataset with all the pers<strong>on</strong>s taking<br />
antidepressants <strong>and</strong> creating a new variable ’number <strong>of</strong> defined<br />
daily dosages bought’*/<br />
data test1;<br />
set b.lmdbcollect;<br />
KEEP apk atc ddd alder udtrnr aar;<br />
proc sort data=test1;<br />
by udtrnr aar;<br />
data ud.lmdbN06A;<br />
set test1;<br />
where ATC like 'N06A%';<br />
ADDK=APK*DDD;<br />
/*summarising over the patients yearly c<strong>on</strong>sumpti<strong>on</strong> <strong>of</strong><br />
antidepressants in the variable antidep*/<br />
data test1;<br />
set b.lmdbN06A;<br />
proc sort data=test1;<br />
by udtrnr aar;<br />
data sumf;<br />
set test1;<br />
by udtrnr aar;<br />
/*BY statement creates First.udtrnr, Last.udtrnr, First.aar, <strong>and</strong><br />
Last.aar*/<br />
if First.aar then antidep=0;<br />
/*Set antidep to 0 when subgroup changes*/<br />
antidep+ADDK;<br />
/*Sum statement creates antidep, retains it, sets initial value to<br />
0, <strong>and</strong> ignores missing<br />
values <strong>of</strong> ADDK*/<br />
if Last.aar then output;<br />
/*output <strong>on</strong>ly the last <strong>of</strong> each BY group*/<br />
data ud.lmdbN06A2;<br />
set sumf;<br />
78