BookmarkSubscribeRSS Feed
MisoLee
Calcite | Level 5

Hi, everyone!

I am sort of self learning to use SAS and hopefully everyone can give me some advice to address my questions. My one-year data set has these fields: hospital id, hospital name, state, city, race/ethnicity, sex, number of cases, mean LOS, primary payer, and so on. I actually want to map the average LOS overall in each state, and then stratified by race/ethnicity in each state. So I am wondering how to start, where I shall get map (shape file with 50 state names but not zipcode), what SAS codes I shall use...etc.

ID           Cases   State   Race   LOS      Insurance

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

00001       500      AZ      White   5.5     Medicaid

00001       50        AZ      Black   6.0     Medicaid

00001      1000     AZ      White   4.5     Medicare

00001       2000    AZ      Black   3.2     Medicare

00002      1000     TX      White   4.9     Medicaid

00002      700       TX      Black   6.6      Medicaid

00002      30000    TX      White   4.0     Medicare

00002     18000     TX      Black   3.9      Medicare

Thank you!

Miso

5 REPLIES 5
GraphGuy
Meteorite | Level 14

Here are the basics that should get you started...

data my_data;

length statecode $2 race $5 insurance $20;

input ID  Cases Statecode Race LOS Insurance;

datalines;

00001       500      AZ      White   5.5     Medicaid

00001       50        AZ      Black   6.0     Medicaid

00001      1000     AZ      White   4.5     Medicare

00001       2000    AZ      Black   3.2     Medicare

00002      1000     TX      White   4.9     Medicaid

00002      700       TX      Black   6.6      Medicaid

00002      30000    TX      White   4.0     Medicare

00002     18000     TX      Black   3.9      Medicare

;

run;

proc gmap data=my_data map=maps.us all;

id statecode;

choro LOS / statistic=mean levels=5;

run;

ballardw
Super User

May need to summarize the data before mapping to apply the weight of the number of cases:

proc summary data=my_data nway;

class statecode;

var Los;

weight cases;

output out=mapdata mean=;

run;

and use

proc gmap data=mapdata map=maps.us all;

You may need to clarify what you mean by stratify by race. A separate map for each level of race you could add race to the

class statement of proc summary above: class race statecode;

and use a BY RACE in the GMAP code.

Darrell_sas
SAS Employee


I would recommend you use MAPSGFK instead of MAPS.

MAPS is going away.  It isn't being updated.

Just change Robert's example from MAPS to MAPSGFK and it will work.

MisoLee
Calcite | Level 5

To answer ballardw: I want to see the average LOS for each racial group in each state. I am not sure what it will look like in SAS. Next, if I want to adjust the LOS by insurance, how should I proceed it? Thank you!

ballardw
Super User

40502 - Annotate a pie chart in selected states with PROC GMAP shows an example of showing a pie chart on each state which may get you started.

You can also spend a lot of time at Robert Allison's SAS/Graph Examples! for many examples of graphs and maps.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1430 views
  • 10 likes
  • 4 in conversation