BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
saramanzella
Fluorite | Level 6

Hello everyone!

 

I'm using SAS Studio.

I have some weights to use in a regression model and I don't know how to trim the distribution of the weights at the 1st and 99th percentile.

The weight variable is already a column in the dataset but I really have no clue how to trim the distribution.

Does anyone have any idea how to do that?

 

Thank you!

Sara

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
proc summary data=have;
    var weight;
    output out=_stats_ p1=p1 p99=p99;
run;

data want;
     if _n_=1 then set _stats_;
     set have;
     if weight<p1 then weight=p1;
     if weight>p99 then weight=p99;
run;

I have never heard of a method that uses weights to reduce the effect of confounders in a regression model. Can you explain this further, or give me a link where I can read about it?

--
Paige Miller

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

What are these weights? Why do you want to trim them? What do you mean by "trim"?

--
Paige Miller
saramanzella
Fluorite | Level 6

I'm doing mediation analysis with time varying exposure and mediator.

I use the weights to do inverse probability of treatment weighting and avoid the effect of confounding in the estimates of the coefficients of the models that I use to obtain direct and indirect effects.

If the history of exposure and mediator are not very probable the weights can become very big. For this reason and to obtain more stable estimators, many suggest to use as a standard procedure the trimming of the distribution of the weights at the 1st and 99th.

The only problem is that I don't know how to do that in SAS.

 

PaigeMiller
Diamond | Level 26

So, please clarify

 

Do you have weights on the variables? Or do you have weights on the observations?


Can you show us a portion of the dataset so we can see the weights, the X-variables and the Y-variables?

--
Paige Miller
saramanzella
Fluorite | Level 6

In the picture there's a part of the dataset. I have weights on the observations.

One of the two models is benessere = ses + fisico and each observation has a different weight.

It's a model in which the wellbeing is regressed on the socio economic status and the physical health.

The weights are obtained as a ratio of probabilities so that we can take into account the effect of different confounders such as sex, ethnicity, marital status, ... .

 

Screenshot 2019-02-14 at 14.45.46.png

PaigeMiller
Diamond | Level 26
proc summary data=have;
    var weight;
    output out=_stats_ p1=p1 p99=p99;
run;

data want;
     if _n_=1 then set _stats_;
     set have;
     if weight<p1 then weight=p1;
     if weight>p99 then weight=p99;
run;

I have never heard of a method that uses weights to reduce the effect of confounders in a regression model. Can you explain this further, or give me a link where I can read about it?

--
Paige Miller
saramanzella
Fluorite | Level 6

The basic idea comes from propensity score matching techniques and inverse probability of treatment weighting. I think that they're really well explained in this paper: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3144483/
To study this method I also used: http://www.stat.cmu.edu/~ryantibs/journalclub/rosenbaum_1983.pdf
Those two can give you a basic idea of the methods to take into account confounding without stratifying.
The thing I'm doing it's a little bit more complicated because it involves mediation analysis but if you're interested in that I suggest you read some of VanderWeele papers or the book he published in 2015 which is called "Explanation in Causal Inference - Methods for Mediation and Interaction".

Thank you very much for the help!
Sara

PaigeMiller
Diamond | Level 26

Thanks for the links!

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 993 views
  • 2 likes
  • 2 in conversation