Data visualization with SAS programming

How to map the LOS by states?

Reply
Occasional Contributor
Posts: 5

How to map the LOS by states?

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

SAS Employee
Posts: 977

Re: How to map the LOS by states?

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;

Super User
Posts: 11,101

Re: How to map the LOS by states?

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.

SAS Employee
Posts: 170

Re: How to map the LOS by states?


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.

Occasional Contributor
Posts: 5

Re: How to map the LOS by states?

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!

Super User
Posts: 11,101

Re: How to map the LOS by states?

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.

Ask a Question
Discussion stats
  • 5 replies
  • 752 views
  • 10 likes
  • 4 in conversation