OPTIONS NOCENTER LS=MAX PS=MAX;
LIBNAME S '.
eport';
/*
PROC PRINT DATA=S.doquestionr(WHERE=(sid=197204) KEEP=SID SN);
RUN;
*/
DATA P3;
SET S.subject;
IF Tid=2267;
RUN;
DATA P2;
SET S.options;
IF Tid=2267;
RUN;
DATA P1;
SET S.doquestionr;
IF Tid=2267;
RUN;
PROC SQL;
CREATE TABLE A1 AS
SELECT P1.*,P2.Content,P3.Question FROM P1 INNER JOIN P2 ON P1.Selected=P2.IdList INNER JOIN P3 ON P1.SId=P3.Id;
RUN;
proc sort data=A1 out=A2;
by sn;
run;
proc transpose data=A2 out=A3(DROP=_LABEL_ NAME) name=name prefix=s_;
by sn;
id sid;
VAR SELECTED;
idlabel Question;
run;
PROC CONTENTS DATA=A3 OUT=A4 NOPRINT;
RUN;
PROC PRINT DATA=A4(KEEP=NAME) NOOBS;
RUN;
proc print data=A3 LABEL;
run;