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

It works! THANK YOU SO MUCH!!

That saves me hours!!!

Reeza
Super User

DMP wrote:

I want only the frequency of value "c" occuring in all 4 vb. (A,B,C,D) in the output. how can I do this?

Thank you!

You put an OR in your code, assuming you want A=B=C=D you want an AND in your where clause instead.

PGStats
Opal | Level 21

Maybe this is closer to what you want :

data test;
length A B C D $1;
input (A B C D) ($1.) @@;
if cmiss(A,B,C,D)=0;
datalines;
abcdedbbcdeabcedeacbdeaceccabedaddea
;

ods select none;
proc freq data=test;
table A B C D;
ods output OneWayfreqs=owf;
run;
ods select all;

data cFreq;
keep var frequency;
set owf;
if cats(of f_:)="c";
var = substr(table,7);
run;

proc print data=cfreq; run;

PG

PG

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
  • 17 replies
  • 1506 views
  • 0 likes
  • 4 in conversation