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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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