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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 421 views
  • 0 likes
  • 3 in conversation