Syntax for creating output dataset in SAS with Proc FREQ

morinia
morinia used Ask the Experts™
on
I have a proc frequency statement and i need to create an output file. The file has a list of members and their respective language.  I need to create an output file that has the total number of members with each language and the respective percentage.

Can anyone tell me the syntax?  The file is Filea  The field is lang  and member_id
Proc FREQ Data = Filea;
  Tables lang;
Run;

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
i would most likely use a PROC SQL statement:

PROC SQL;
create table f1 as
  select lang, count(*) as Freq from filea
  group by lang;

create table f2 as
  select lang, freq, freq/sum(freq) as perc format=percent12.
 from f1;
quit;

Commented:
Proc Freq data= Filea;
   tables lang / out=FreqOut;
run;

proc export data=FreqOut
outfile="c:\sasoutput\freqout.csv"
DBMS=CSV REPLACE;
run;

this will create your proc freq as a SAS dataset and then export it to a CSV file so that you can pull it into another application of your choice.  Is this what you are looking for?
moriniaAdvanced Analytics Analyst

Author

Commented:
Both solutions were great.  I was given two approaches to solve the problem.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial