Hi - I have a wide flat dataset with column response rates of binomial questions: sample#, col1a, col1b, col2a, col2b...colna, colnb 1, 50%,50%,20%,80%,...,0%,100% 2, 0%,100%,80%,20%,...,50%,50% I would like to run proc freq /chisq to compare samples 1 & 2. Prefer to use proc sql to process two columns at a time (q# A and B) but difficult to get proc freq to accept wide flat dataset because proc freq prefers a transpose format like below? 1,col1a,50% 1,col1b,50% 2,col2a,20% 2,col2b,80% ... n,colna,0% n,colnb,100% my pseudo code with syntax errors below - please help? thanks! /*compute counts from columns A/B ; save headers for loop*/ proc contents data=work.widefile18 Out=work.headers order=VARNUM; run; /*process first question: COLA and COLB*/ proc sql; CREATE TABLE HEADERNAME AS SELECT VARNUM, NAME FROM work.headers WHERE (VARNUM in (4,5 )); %let resultcount=&sqlobs; QUIT; /*compute counts*/ %MACRO LOOP2(); proc sql; select NAME into :COLA from HEADERNAME where VARNUM=1; select NAME into :COLB from HEADERNAME where VARNUM=2; quit; data collab; set work.widefile18; count=1*vvaluex(COLA); output; count=1*vvaluex(COLB); output; run;%MEND; /*loop COLA to COLB datastep */ %global i; do i = 1 to 2; DATA HEADERNAME; SET HEADERNAME; CALL EXECUTE("%LOOP2("||TRIM("sample &i",&COLA,&COLB)||")"); proc freq data=work.collab; by count; tables sample*COLA /chisq; run; %let i=&i+1; end;*/ RUN;
... View more