ass4- solution

# ass4- solution - UNIVERSITY OF HONG KONG DEPARTMENT OF...

This preview shows pages 1–3. Sign up to view the full content.

UNIVERSITY OF HONG KONG DEPARTMENT OF STATISTICS AND ACTUARIAL SCIENCE STAT1303 DATA MANAGEMENT (SEMESTER 1 2009/2010) Suggested Solutions of Assignment 4 Question 1 (a) proc sort data=diag; by gender group; run; proc means data=diag; var x; by gender group; output out=mdiag mean=mx; run; (b) (i) proc sort data=mdiag; by gender; run; data mdiagt; array mlist(*) m1-m5; retain m1-m5; set mdiag; by gender; if first.gender then do; do i = 1 to 5; mlist(i)=0; end; end; mlist(group) = mx; if last.gender; drop i; run; data mdiagt; set mdiagt; keep gender m1-m5; run; (ii) proc sort data=mdiagt; by gender; run; proc sort data=diag; 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
by gender; run; data diag1; merge diag mdiagt; by gender; array mxlist(*) m1-m5; array dxlist(*) dx1-dx5; do i = 1 to 5; dxlist(i) = x - mxlist(i); end; drop i; run; Question 2 n Temp (a) data familyt(keep=famid year income expense debit); set a4q2.family; array inclist(*) inc90-inc99; array explist(*) exp90-exp99; array deblist(*) deb90-deb99;
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 05/04/2011.

### Page1 / 3

ass4- solution - UNIVERSITY OF HONG KONG DEPARTMENT OF...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online