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