BookmarkSubscribeRSS Feed
RebeccaB_
Obsidian | Level 7

Hello, 

 

I'm hoping to create code that will conduct propensity score matching on principal components I've created in a PCA.

 

The data set is census data, where we created principal components on zip codes to understand underlying constructs of different zip codes throughout the state. I've flagged intervention zip codes where we have interventions being implemented, and the rest of the zip codes are controls. I've created propensity scores using PROC LOGISTIC. 

 

I'm trying now to use fuzzy matching to match propensity scores for intervention zips to control zips on a 1:2 ratio. 

 

CODE: 

Proc Factor data= (data set)
out= work.pc_zip
nfact=11
simple
method=prin
priors=one
mineigen= 0.99
scree
rotate=varimax
round
flag=.40 ;
var (variables)
run;

 

*flagging intervention zips; 
data work.pca_flag;
set work.pc_zip;
if zcat5 in (intervention zip codes) then interven=1; else interven=0;
run;


*creating propensity scores;
proc logistic data=work.pca_flag descending;
model interven = factor1 factor2 factor3 factor4 factor5 factor6 factor7 factor8 factor9 factor10;
run;

 

Thank you! 

1 REPLY 1
Reeza
Super User

Have you considered using PROC PSMATCH instead?

Example: Matching with precomputed propensity scores

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

 

Otherwise, there's a couple of matching macro's here, GMATCH and VMATCH:

http://bioinformaticstools.mayo.edu/?category=20

 


@RebeccaB_ wrote:

Hello, 

 

I'm hoping to create code that will conduct propensity score matching on principal components I've created in a PCA.

 

The data set is census data, where we created principal components on zip codes to understand underlying constructs of different zip codes throughout the state. I've flagged intervention zip codes where we have interventions being implemented, and the rest of the zip codes are controls. I've created propensity scores using PROC LOGISTIC. 

 

I'm trying now to use fuzzy matching to match propensity scores for intervention zips to control zips on a 1:2 ratio. 

 

CODE: 

Proc Factor data= (data set)
out= work.pc_zip
nfact=11
simple
method=prin
priors=one
mineigen= 0.99
scree
rotate=varimax
round
flag=.40 ;
var (variables)
run;

 

*flagging intervention zips; 
data work.pca_flag;
set work.pc_zip;
if zcat5 in (intervention zip codes) then interven=1; else interven=0;
run;


*creating propensity scores;
proc logistic data=work.pca_flag descending;
model interven = factor1 factor2 factor3 factor4 factor5 factor6 factor7 factor8 factor9 factor10;
run;

 

Thank you! 


 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1 reply
  • 797 views
  • 1 like
  • 2 in conversation