Hi everyone,
I'd like to ask if there is an easy to way to do crosstab of many variables with the same prefix.
For my data, there are 45 fields, Q1-Q45, and 45 corresponding recoded variables based on Q1-Q45, rQ1-rQ45. I want to make sure that the recoding is done right by checking crosstab like
proc freq data=mydata;
table Q1*rQ1 Q2*rQ2 Q3*rQ3 … Q45*rQ45;
run;
I want to have something quick rather than typing each set from Q1 to Q45. Any thoughts?
Thank you!
Lizi
A simple macro would work
%macro dothis;
proc freq data=mydata;
table %do i=1 %to 45; Q&i*rQ&i %end; ;
run;
%mend;
%dothis
A simple macro would work
%macro dothis;
proc freq data=mydata;
table %do i=1 %to 45; Q&i*rQ&i %end; ;
run;
%mend;
%dothis
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.