BookmarkSubscribeRSS Feed
saza
Quartz | Level 8

I am trying to sort my data from a dataset in order to make a gmap and was asked the following:

  1. Choose one cause (high blood pressure, obstructive heart disease, or stroke) and one level of sex (all, female, or male) and subset your data to only those levels.
  2. Use the “levels” option or define your own categories with proc format and the “discrete” option to display no more than five levels of either visits or visit rates.

This is my code:

 


proc sort data = saslab3;
by sex= 'female' cause= 'storke';
run;

proc gmap map = usstates
data = saslab3
all;
id sex ='female' cause= 'stroke';
choro ER_Visit_rate / levels = 3 missing;
run;
quit;

 This is the error I am receiving when I run proc sort:

saza_0-1648986764552.png

This is my legend:

saza_1-1648986802924.png

When I run the GMAP code I get the following error:

saza_0-1648987687747.png

I was told USstates exists in sas?

 

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

From now on, please include logs as plain text (not screen captures) by clicking on the </> icon and then pasting your log into the window that appears.

 

Insert Log Icon in SAS Communities.png

 

You cannot do subsetting in a BY statement or an ID statement. You do subsetting in a WHERE statement, you can do this in PROC GMAP, and then PROC SORT isn't needed. Give it a try.

 


@saza wrote:

When I run the GMAP code I get the following error:

saza_0-1648987687747.png

I was told USstates exists in sas?

 

 


If you look in your WORK library, you do not see USSTATES, so you have the wrong library. If you look in the MAPSGFK library, you find a data set that is spelled US_STATES, perhaps that is the one you want.

--
Paige Miller
saza
Quartz | Level 8
I was able to sort in both gmap and proc sort, thank you!
I am now only getting an error that states "sex" is not a variable on the US_States map. I am having trouble accessing that map so I can rename the sex variable within it.
PaigeMiller
Diamond | Level 26

Yes, US_STATES is a map data set, it contains the co-ordinates of the boundaries of the different states so that a map can be drawn. It doesn't contain SEX.

 

You provide a "legend" showing a variable named SEX, what data set is that?

 

Also, no need for PROC SORT.

 

 

--
Paige Miller

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!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 433 views
  • 1 like
  • 2 in conversation