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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 15161 views
  • 0 likes
  • 3 in conversation