BookmarkSubscribeRSS Feed
ssas
Calcite | Level 5
Hi,

I have 20 tables and each table got around 650 observations with 12 variables.
6 variable(column names are same) they are firstname lastname postcode email id.
i would like to pick out the common observations which got same values in the all tables.

I am tried to make all the observations to upppercase and merging them using (in) in merge,
if a and b ............
but i am unable to workout.
its some thing like
if a and/or b and/or c ...
could any one please suggest the correct logic or datastep or proc sql

Thanks,
suresh
4 REPLIES 4
LinusH
Tourmaline | Level 20
If you mean "common observations" as has common values in the BY/id columns, it would be something like in your example:

data common;
merge a(in=a) b(in=b) c(in=c) d(in=d) e(in=e) f(in=f);
by firstname lastname postcode email id;
if a and b and c and d and e and f;
run;

All tables need to be sorted on the BY columns.

/Linus
Data never sleeps
Patrick
Opal | Level 21
This is a SQL variant:

proc sql;
create table ObsAndVarsCommon as
select * from Table1
intersect corr all
select * from Table2
intersect corr all
select * from Table3
.....and so on and so on
;
quit;
ssas
Calcite | Level 5
I mean
i have 20 shows ( 1 table for each show).
i would like to find out how many people attended how many shows with respect to their
first name, last name, postcode and gender.

Thanks,
suresh
Patrick
Opal | Level 21
data Vall / view=Vall;
set a(in=a) b(in=b) c(in=c) d(in=d) e(in=e) f(in=f);
if a then show='a';
else if b then show='b';
else if....
run;

proc tabulate data=Vall;
.....and then work out what list you really want.

HTH
Patrick

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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