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

Hi,

I have two table in my sas library. Table 1 and Table 2 below and from the two tables I want to be abler to add an extra column to table 1 to make another table; table 3 below. Is there a faster way of doing this in SAS, any help will be most appreciated.

Table 1.

obs     site id    

1          256

2          301

3          457

4          457

5          323

6          421

7          256

8          301

9          301

10        421 

Table 2.

site id     site name

256          ebay

301          yahoo

457          ebay

323          msn

421          msn

Table 3.

obs     site id     site name

1          256          ebay

2          301          yahoo

3          457          ebay

4          457          ebay

5          323          msn

6          421          msn

7          256          ebay

8          301          yahoo

9          301          yahoo

10        421          msn 

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

One way would be to use proc sql to simply join the two tables.  e.g.,

proc sql noprint;

  create table table3 as

    select a.*, b.sitename

      from table1 as a,

           table2 as b

        where a.siteid=b.siteid

  ;

quit;

View solution in original post

2 REPLIES 2
art297
Opal | Level 21

One way would be to use proc sql to simply join the two tables.  e.g.,

proc sql noprint;

  create table table3 as

    select a.*, b.sitename

      from table1 as a,

           table2 as b

        where a.siteid=b.siteid

  ;

quit;

Osebeyo
Fluorite | Level 6

Thanks Art, i will apply this now.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 701 views
  • 0 likes
  • 2 in conversation