BookmarkSubscribeRSS Feed
Julie4
Fluorite | Level 6

Hello, I have a question regarding way to weight population for each individual.

I have used syntax below to have fractional rank but found out that I need to weight total population of every insur_level before doing the PROC RANK syntax.

I have created the sample data set to let you understand what I mean easier.

Could anybody help me 'weighting' the population?

 

Julie4_0-1638064146410.png

 

 

PROC RANK DATA=SSTEMP OUT=TEMP;

VAR INSUR_LEVEL;

RANKS INSUR_RANK;

RUN;

 

PROC MEANS DATA=TEMP NOPRINT;

VAR INSUR_RANK;

OUTPUT OUT=INSUR_RANK_MAX MAX=INSUR_RANK_MAX;

RUN;

 

DATA TEMP2;

SET TEMP;

IF _N_=1 THEN SET INSUR_RANK_MAX;

INSUR_RANK_FRAC=INSUR_RANK/INSUR_RANK_MAX;

RUN;

 

6 REPLIES 6
mkeintz
PROC Star

Why are you doing this?  The more ties you have at the top INSUR_LEVEL, the smaller will the the max_rank, and the larger will be the resulting INSUR_RANK_FRAC for all the other INSUR_LEVEL values.

 

Assume you have 100 observations and the top two values were 98 and 99.   If those two values have nine observations at 98, and one at 99, you would get different results from one obs at 98 and nine at 99.  In the earlier case (one obs at 99) you'd have max rank of 100.  In the latter the max_rank would be 96.  Is that ok?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Julie4
Fluorite | Level 6

Julie4_0-1638097433516.png

I'm trying to calculate Concentration Index in Health equity and the reference I found above said that the sample must be weighted. 

PaigeMiller
Diamond | Level 26

@Julie4 wrote:

I have a question regarding way to weight population for each individual.


Please explain this further ... What analysis is planned such that weighting is required, and why is it required?

 

I have created the sample data set to let you understand what I mean easier.

 

I don't understand any of this. Where does weighting fit in? Why do you need weighting? Weighted by what? What variable needs to be weighted? What is the analysis you are doing?

--
Paige Miller
Julie4
Fluorite | Level 6

Julie4_0-1638097612653.png

I am trying to calculate Health Concentration Index and I'm trying to weight the sample because the reference that I found said that the sample must be weighted.

PaigeMiller
Diamond | Level 26

Okay, thank you, but now explain the connection between the problem you posted and this text. What variable in your data set is the w in the text?

--
Paige Miller
Julie4
Fluorite | Level 6

INSUR_LEVEL should be weighted(analytic weight) by POPULATION.

After that, I should compute fractional rank with the syntax that I wrote.

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!
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
  • 6 replies
  • 488 views
  • 0 likes
  • 3 in conversation