options nocenter ps = 65 ls = 75; filename graphout "MyGraphs"; goptions device=png gsfname=graphout hby=2; proc template; Define style styles.mystyle; * Parent=styles.default; Parent=styles.listing; Style GraphTitleText / color=blue fontsize=15pt fontfamily="Roman" fontweight=bold; Style GraphValueText / color=black fontsize=18pt fontfamily="Roman" fontweight=medium; Style GraphLabelText / color=black fontsize=18pt fontfamily="Roman" fontweight=medium; end; run; goptions reset=symbol; ods listing style=mystyle; data mus; infile "http://staff.pubhealth.ku.dk/~lts/basal/data/brain.txt" URL firstobs=2; input litter body brain; run; /* Spørgsmål 1 */ title 'Spm 1'; ods graphics / reset imagename='brain-litter'; proc sgplot data=mus; scatter Y=brain X=litter; run; /* Spørgsmål 2 */ title 'Spm 2'; ods graphics / reset imagename='brain-litter-reg'; proc sgplot data=mus; reg Y=brain X=litter; run; ods graphics / reset imagename='glm-brain-litter'; proc glm plots=all data=mus; model brain=litter / solution clparm; estimate "brain for litter=5" intercept 1 litter 5; run; /* Spørgsmål 3 */ title 'Spm 3'; ods graphics / reset imagename='brain-body-reg'; proc sgplot data=mus; reg Y=brain X=body; run; proc reg data=mus; model brain=body / clb; run; ods graphics / reset imagename='glm-brain-body'; proc glm plots=all data=mus; model brain=body / solution clparm; estimate "brain for body=10" intercept 1 body 10; run; /* Spørgsmål 4 */ title 'Spm 4'; proc corr pearson spearman data=mus; var litter body; run; /* Spørgsmål 5 */ title 'Spm 5'; ods graphics / reset imagename='body-litter-reg'; proc sgplot data=mus; reg Y=body X=litter; run; ods graphics / reset imagename='glm-body-litter'; proc glm plots=all data=mus; model body=litter / solution clparm; estimate "body for litter=5" intercept 1 litter 5; run; /* Spørgsmål 6 */ title 'Spm 6'; ods graphics / reset imagename='glm-brain-multipel'; proc glm plots=all data=mus; model brain=litter body / solution clparm; estimate "body for litter=5, body=10" intercept 1 litter 5 body 10; run; */************************************************/; data sol; input soltimer biomasse; datalines; 29.7 16.6 68.4 49.1 120.7 121.7 217.2 219.6 313.5 375.5 419.1 570.8 535.9 648.2 641.5 755.6 ; run; /* Spørgsmål 1 */ title 'Spm 1'; ods graphics / reset imagename='scatter-biomasse-sol'; proc sgplot data=sol; scatter Y=biomasse X=soltimer; run; ods graphics / reset imagename='reg-biomasse-sol'; proc sgplot data=sol; reg Y=biomasse X=soltimer; run; /* Spørgsmål 2 */ title 'Spm 2'; ods graphics / reset imagename='glm-sol'; proc glm plots=all data=sol; model biomasse=soltimer / solution clparm; *test soltimer=1; estimate "sol=200" intercept 1 soltimer 200; run; /* Spørgsmål 3 */ title 'Spm 3'; ods graphics / reset imagename='glm-sol-uden-intercept'; proc glm plots=all data=sol; model biomasse=soltimer / noint solution clparm; estimate "sol=200" soltimer 200; run;