BookmarkSubscribeRSS Feed
jcis7
Pyrite | Level 9

Hello, I'm trying to update admin contact name & email information from the 'PrivAdmins' table into the 'Facilities' table.

the 'PrivAdmins' table has more facility codes than the 'Facilities' table.

But I only want the contact info for those facility codes that are in Table A updated (I don't want to add the facility codes listed in only listed in Table B but not Table A).

PrivAdmins Table

FacilityCode  AdminName   AdminEmail

                       AdminAdmin   admin@gmail.com       /*this table has facility codes with missing values too*/

12345              Carla Lan      carlalan@gmail.com    

12346              Patrick Miles  pmiles@dmac.org

Facilities Table

FacilityCode  AdminName   AdminEmail.            FacilityName (more variables)...

12345                                                                     FacilityA

12349             Niger Kopak    nk@cmac.com         FacilityB

Desired Result (Adminsp table)

FacilityCode AdminName      AdminEmail                   Facility Name (more variables)...

12345           Carla Lan         caralan@gmail.com         FacilityA

12349          Niger Kopak      nk@cmac.com                FacilityB

I used this code but it doesn't work.

data adminsp;



update facilities privadmins;



by facilitycode;



run;

1 REPLY 1
Astounding
PROC Star

Is this what you are looking for?

data Adminsp;

merge Facilities (in=in1) PrivAdmins (in=in2);

by FacilityCode;

if in1;

run;

If not, you might have to explain with more than "it doesn't work".  What do you get vs. what do you need?

Good luck.

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
  • 1 reply
  • 650 views
  • 0 likes
  • 2 in conversation