Hi Everyone,
I have been trying to create a spatial distribution map within 5 data ranges. Can someone please help me to detect why that's not working? The data ranges are given in the proc format section. Here are the codes:
goptions reset=all border;
title "County-level social capital levels, 2005";
proc gproject
data=maps.Counties
out=allcounties;
where state ne 2 and state ne 15 and state ne 72;
id state county;
run;
proc format ;
value sk_
1 = '-3.9094 - -1.0853'
2 = '-1.0852 - -0.5139'
3 = '-0.5138 - 0.0916'
4 = '0.0917 - 0.9486'
5 = '0.9487 - 14.2963'
;
run;
pattern1 v=s c=grayff;
pattern2 v=s c=grayaa;
pattern3 v=s c=graybb;
pattern4 v=s c=graycc;
pattern5 v=s c=graydd;
proc gmap
data=temp.social_capital_2005
map=allcounties all density=5;
id state county;
choro sk ;
format sk sk_.;
run;
quit;
I have also provided the data in the data section. Thanks in advance for your help.
The final output should be very similar to the 2005 sample in the link. https://aese.psu.edu/nercrd/community/social-capital-resources/us-maps-showing-county-social-capital...
Your format for SK_ is incorrect. You attempt to use values of 1, 2, 3,4 and 5 for SK when the actual values are quite different.
Also, your indicated ranges overlap which is a no-no in general. Formats use value on the LEFT side of the = and display the value on the right side.
Try this format and see if things are better.
proc format ; value sk_ -3.9094 - -1.0852 = '-3.9094 - -1.0852' -1.0852< - -0.5138= '-1.0853 - -0.5138' -0.5138< - 0.0916 = '-0.5139 - 0.0916' 0.0916< - 0.9486 = '0.0917 - 0.9486' 0.9486< - high = '0.9487 - 14.2963' ; run;
the < in the ranges indicates an open interval, so does not overlap with the previous and provides rules for if there is an actual value of -1.08524.
@bd_user_10 wrote:
Hi Everyone,
I have been trying to create a spatial distribution map within 5 data ranges. Can someone please help me to detect why that's not working? The data ranges are given in the proc format section. Here are the codes:
goptions reset=all border;
title "County-level social capital levels, 2005";
proc gproject
data=maps.Counties
out=allcounties;
where state ne 2 and state ne 15 and state ne 72;
id state county;
run;
proc format ;
value sk_
1 = '-3.9094 - -1.0853'
2 = '-1.0852 - -0.5139'
3 = '-0.5138 - 0.0916'
4 = '0.0917 - 0.9486'
5 = '0.9487 - 14.2963'
;
run;
pattern1 v=s c=grayff;
pattern2 v=s c=grayaa;
pattern3 v=s c=graybb;
pattern4 v=s c=graycc;
pattern5 v=s c=graydd;
proc gmap
data=temp.social_capital_2005
map=allcounties all density=5;
id state county;
choro sk ;
format sk sk_.;
run;
quit;
I have also provided the data in the data section. Thanks in advance for your help.
The final output should be very similar to the 2005 sample in the link. https://aese.psu.edu/nercrd/community/social-capital-resources/us-maps-showing-county-social-capital...
Your format for SK_ is incorrect. You attempt to use values of 1, 2, 3,4 and 5 for SK when the actual values are quite different.
Also, your indicated ranges overlap which is a no-no in general. Formats use value on the LEFT side of the = and display the value on the right side.
Try this format and see if things are better.
proc format ; value sk_ -3.9094 - -1.0852 = '-3.9094 - -1.0852' -1.0852< - -0.5138= '-1.0853 - -0.5138' -0.5138< - 0.0916 = '-0.5139 - 0.0916' 0.0916< - 0.9486 = '0.0917 - 0.9486' 0.9486< - high = '0.9487 - 14.2963' ; run;
the < in the ranges indicates an open interval, so does not overlap with the previous and provides rules for if there is an actual value of -1.08524.
@bd_user_10 wrote:
Hi Everyone,
I have been trying to create a spatial distribution map within 5 data ranges. Can someone please help me to detect why that's not working? The data ranges are given in the proc format section. Here are the codes:
goptions reset=all border;
title "County-level social capital levels, 2005";
proc gproject
data=maps.Counties
out=allcounties;
where state ne 2 and state ne 15 and state ne 72;
id state county;
run;
proc format ;
value sk_
1 = '-3.9094 - -1.0853'
2 = '-1.0852 - -0.5139'
3 = '-0.5138 - 0.0916'
4 = '0.0917 - 0.9486'
5 = '0.9487 - 14.2963'
;
run;
pattern1 v=s c=grayff;
pattern2 v=s c=grayaa;
pattern3 v=s c=graybb;
pattern4 v=s c=graycc;
pattern5 v=s c=graydd;
proc gmap
data=temp.social_capital_2005
map=allcounties all density=5;
id state county;
choro sk ;
format sk sk_.;
run;
quit;
I have also provided the data in the data section. Thanks in advance for your help.
The final output should be very similar to the 2005 sample in the link. https://aese.psu.edu/nercrd/community/social-capital-resources/us-maps-showing-county-social-capital...
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.