*Example #2: Study Abroad in South America*; *1. Import your data*; proc import datafile='P:\StudyAbroad.xlsx' dbms=excel out=work.studyabroad replace; run; *2. Rename imported data variables*; data work.studyabroad; set work.studyabroad; rename Country=IDNAME; rename Study_Abroad_Students= sastudents; run; *3. Create a new dataset so that proc gmap understands the country reference*; data work.studyabroadmap; set maps.sameric2; *Sameric2 matches country and ID. Samerica is the dataset used to draw the map*; keep ID idname; run; *4. Sort the data sets or the merge will not work*; Proc sort data=work.studyabroad; by IDNAME; run; Proc sort data=work.studyabroadmap; by IDNAME; run; *5. Merge the datasets so that SAS can comprehend which country is which in the GMAP procedure*; data work.combined; merge work.studyabroad work.studyabroadmap; by idname; run; *6. Create a new variable that changes actual study abroad figures into 5 groups*; data work.combined; set work.combined; if sastudents ge 1 and sastudents le 5 then students = 2; else if sastudents ge 6 and sastudents le 10 then students = 3; else if sastudents ge 11 and sastudents le 15 then students = 4; else if sastudents ge 16 then students = 5; else students = 1 ; run; *7. Use a format function to change the names of the values of the variable student*; proc format; value students 1 = 'None' 2 = '1 - 5' 3 = '6 - 10' 4 = '11 - 15' 5 = '16+'; run; *8. Choose options and run PROC GMAP*; %let name=students; filename odsout 'C:\output_location'; *You will need to name your output location for the physical file here*; goptions reset = global cback =white colors = (black) border; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Study Abroad in South America") style=sasweb; pattern1 value=solid color=CXFFFFFF; pattern2 value=solid color=CXF2F2F2; pattern3 value=solid color=CXBFBFBF; pattern4 value=solid color=CX7F7F7F; pattern5 value=solid color=CX4B4B4B; goptions gunit=pct htitle=5 ftitle="Calibri/Bold" htext=2.7 ftext="Calibri"; *htitle=title size, htext=legend size, ftitle=title font*; legend1 label=none shape=bar(4,3) value=(justify=left 'None' '1-5' '6-10' '11-15' '16+') across=1 origin=(70,10) mode=share; title1 lspace= 5 "Students Studying Abroad in South America 2012"; *lspace=line space from the top*; footnote1 justify=left "This data is merely for display purposes. Also, to show a footnote example"; proc gmap data=work.combined map=maps.samerica; id id; choro students / midpoints=1 2 3 4 5 coutline=black legend=legend1 des='StudyAbroad' name="SouthAmericaStudyAbroad"; run; quit; ODS HTML CLOSE; ODS LISTING;