BookmarkSubscribeRSS Feed
sambasiva_ravuri_tcs_com
Calcite | Level 5


Dear All,

I tried to execute below program using PROC FREQ. While executing this program, added OUT Parameter in FREQ Procedure. My expectation is in the OUT SAS Data set (full) will create all the fields data. But unfortunately, am getting only ID Data only. Please suggest me or help me , how can I get all fields data into SAS Data set Full ( which is creating as part of OUT Parameter in PROC FREQ).

 

options obs=max compress=yes;

libname a "/root/samba/d071212";

PROC FREQ DATA = a.test1;

tables Accountnumber

SOURCE

DATE_STAMP

TIME_STAMP

SEQ_NO

NAME_PREFIX

ID /list missing

out=a.full;

Regards,

S Ravuri.

2 REPLIES 2
ballardw
Super User

From the online help:

If more than one table request appears in the TABLES statement, the contents of the OUT= data set correspond to the last table request in the TABLES statement.

So do you need counts only or percents as well?

Options:

      Use Proc freq with multiple tables statements creating multiple output data sets and then combine the output sets.

     Use another procedure.

MikeZdeb
Rhodochrosite | Level 12

hi ... OUT= will only contain one table, that for the last variable listed in the TABLES statement

you can try ODS to get all the results in one data set, for example ...

ods listing close;

ods output onewayfreqs=tables (drop=f_:);

proc freq data=sashelp.class;

tables _all_ / missing;

run;

ods output close;

ods listing;


the resulting data set is a little "messy" and you'll have to write a bit of SAS code to make it usable  (the DROP data set option drops the formatted values of variables from the data set so if you also want them, get rid of the DROP)


I wrote a paper about using the above SAS code to create a missing data report and it has some ideas you might be able to use in looking at the data set you get from PROC FREQ ...


http://www.nesug.org/Proceedings/nesug11/ds/ds12.pdf


hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 1557 views
  • 1 like
  • 3 in conversation