Hi Tom,
I need one more guidance on the proc frequency. I have report to be generated with 250 attributes or variables. in the below code i want the attributes to keep changing till 250 automatically and get the combination. is there any way or do i need to hardcode.
proc freq;
tables brand*market*aa1*(attrib1)*b5_own /noprint out=freq ;
weight weight ;
run;
What i am currently doing is
%macro attrib;
proc freq;
tables brand*market*aa1*(&attributes)*b5_own /noprint out=freq ;
weight weight ;
run;
%mend attrib;
%attrib (attributes= attrib1 attrib2 attrib3.....till attrib250).
Can you please guide is there any smarter way to do this?
Thanks and Regards,
S.S.Pradeep
If your variables are named with numeric suffixes as in your example then you can use variable list syntax.
attrib1 - attrib250
If not, but you know the physical order of the variables in the dataset then you can use -- between the names
age -- race
Hi Tom,
Thank you for the guidance. As you suggested Proc summary is the best choice. I tried running both proc freq and proc summary.
1. Proc freq - i got the percent frequency count and percentage of total frequency in the output dataset - so if i remove the noprint option and run i am getting the exact number which i am looking out for.
2. proc summary - here i got the type , freq and weight in the output dataset. how can i go about in converting or transpoing the dataset to the exact percentage i am getting in proc freq.
Please guide,
Thanks and Regards,
S.S.Pradeep
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.