BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ArchanaSudhir
Obsidian | Level 7

Hi all,

I am trying to use PROC FREQ.

1. I don't want any other information except count (tried using NOROW NOCOL NOPERCENT as well as /LIST).

.

2 In the same step, I also want to output the data to another dataset (output).

proc freq data = abc NOPRINT;

tables xyz/ NOROW NOCOL NOPERCENT out = output ;

RUN;

tables xyz/ out = output1 (drop = percent) / LIST;

I know I am doing some syntax error. Please help.

Thanks,

Archana

1 ACCEPTED SOLUTION

Accepted Solutions
MikeZdeb
Rhodochrosite | Level 12

Hi.  Since you know what you want in data set OUTPUT1, try using KEEP ...

tables xyz/ out=output1 (keep=xyz count);

Also, you're only allowed one slash (/) in the TABLES statement.  You can list multiple options after that slash.

Here's an  example with a printed table of just counts plus an output data set with just counts ...

proc freq data=sashelp.class;

table age / out=counts (keep=age count) nopercent nocum;

run;

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Not too familiar with freq, you could do means though:

proc means data=abc;

     var xyz;

     output out=out_dataset n=n;

run;

Also remember, you can put:

ods trace one;

Before your freq and see what objects are created, then do;

ods output <object>=<dataset>;

MikeZdeb
Rhodochrosite | Level 12

Hi.  Since you know what you want in data set OUTPUT1, try using KEEP ...

tables xyz/ out=output1 (keep=xyz count);

Also, you're only allowed one slash (/) in the TABLES statement.  You can list multiple options after that slash.

Here's an  example with a printed table of just counts plus an output data set with just counts ...

proc freq data=sashelp.class;

table age / out=counts (keep=age count) nopercent nocum;

run;

ArchanaSudhir
Obsidian | Level 7

Thanks a lot MikeZdeb, you answered perfectly Smiley Happy

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 16774 views
  • 0 likes
  • 3 in conversation