BookmarkSubscribeRSS Feed
genius99
Calcite | Level 5

I have two data sets, and I want to assign a continent to each country. how do I do that?

I have attached the data

 

2 REPLIES 2
Kurt_Bremser
Super User

Create a value format that connects countries to continents, and use that:

proc format;
value $continents
  "Switzerland" = "Europe"
  "Austria" = "Europe"
  "USA" = "North America"
  /* and so on */
;
run;

data want;
set have;
continent = put(country,$continent.);
run;
Jagadishkatam
Amethyst | Level 16

May be if you post the sample data and expected output it would help to get better responses.

However I will try

 

You can derive the continent based on the country something as below , alternatively you can use the format if we can know all countries and respective continents

 

If country='Germany' then continent='Europe';
else if country='China' then continent='Asia';
etc., 

 

Thanks,
Jag

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 568 views
  • 0 likes
  • 3 in conversation