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


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