Recently in the SAS Community Library: SAS' @Sundaresh1 highlights a sometimes overlooked task when applying document embeddings for purposes of similarity-based search. Normalisation of vectors helps obtain relevant matches.
Hi,
I’ve run a propensity score analysis with inverse probability of treatment weights (IPW) using SAS PROC CAUSALTRT.
I want to plot the logit of the propensity score after IPW, but can’t figure out how to weight the propensity scores in the code I’m using to generate the plot. Example code from SAS included below:
proc template;
define statgraph densityplot;
begingraph;
entrytitle "Highway Mileage Distribution by Origin";
layout overlay /
xaxisopts=(griddisplay=on
gridattrs=(color=lightgray pattern=dot))
yaxisopts=(griddisplay=on
gridattrs=(color=lightgray pattern=dot));
densityplot mpg_highway / name="densityplot" group=origin;
discretelegend "densityplot" / title="Origin:";
endlayout;
endgraph;
end;
run;
proc sgrender template=densityplot data=sashelp.cars;
run;
I have seen papers which use IPW and report the propensity score graphically before and after IPW. I assume these researchers have weighted the propensity score in the after plot, but I don't understand how to achieve this, or if this is the correct approach to generate the propensity score plot after IPW?
In my output, I have a propensity score variable and the IPW variable.
Any help/advice would be greatly appreciated,
Thank you
... View more
Hello, I want to create just Xbar chart for LOS(hours) quartely with 8 subgroups using SAS.,
I used XSCHART , it will give me both both X-bar and S charts together. Same for XR chart.
but I only want to have X-bar chart.
I also cannot use only xchart in my SAS code as xchart is used for individual data not for subgroup data.
How can I adjust my SAS code to see only the X-bar chart in my output?
proc shewhart data=MIS; xSchart LOS*AdmitYYQ / Markers outtable=outtable ; run;
Attached is the output to see both are in the same frame.
Thanks
... View more
Hello everyone, I am trying to select alternate columns from my dataset, starting from column number 1 and including every nth alternate column after that. For example, I want to select columns 1, 3, 5, 7, and so on up to column n. Is there a way to make this selection without having to manually specify the column names? Here are my column headers: FINAL_STATUS_01MAY24, FINAL_STATUS_02MAY24, and so on...
I would appreciate any help or advice. Thank you!
... View more
I have a scenario as follows:
data have; input id var1 var2; datalines;
1 . 5 2 3 4 3 4 5 5 0 6 6 9 8 ; run;
%let nvar = 2;
%let v1 = 5; /*Condition for var1*/
%let v2 = 8; /*Condition for var2*/
When i run this array , i am getting error.
data want; set have; array var{2} var1 : var&nvar; array flag{2} flag1-flag&nvar; do i = 1 to 2; if var{i} >= 5 then flag{i} = 1; else flag{i} = 0; end; drop i; run;
This above code run correct but what i need is that instead of var{i} >= 5 i have to replace by var{i} >= &v{i} so i make
the condition to change as i changes.
However this modification does not work ,saying it can not resolve &v{i}.
Any suggestion ? Thank you.
... View more
I have very little experience working with weights, so please correct me if my understanding is wrong.
I'm trying to create a summary table of unadjusted rates of quality of care between the TM and MA groups. I was able to produce a table with Proc Ttest and ODS. However, the survey uses a complex design. I need to add a weight variable and, it appears, replicate weight variables. Unfortunately, Proc Ttest can accommodate a weight variable but not replicate weights.
Just to experiment, I tried running Proc Ttest with the weight variable, and the sig score for the variables improved. That confuses me, because the study documentation says "To permit the calculation of random errors due to sampling, a series of replicate weights were computed. Unless the complex nature is taken into account, estimates of the variance of a survey statistic may be biased downward." In other words, not using weights means underestimating the variance. And if the true variance is actually higher, shouldn't that reduce the significance level? One particular variable I looked at has a probt score of 0.0158 when unweighted, and 0.0025 when weighted.
Based on what I found in the study documentation, I'm trying to use Proc Surveyfreq instead. However, this is confusing me as well. The Pr > ChiSq score is now <.0001 for every variable, even those that were not significant when I used Proc Ttest.
Here is the code, with sample data and Proc TTest commented out. I'm only including 1 of the replicate weights here, but there are actually 100 of them:
data have;
infile datalines dsd dlm=',' truncover;
input ACC_HCTROUBL_r ACC_HCDELAY_r ADRD_group TM_group
PUFFWGT PUFF001;
datalines;
3,1,1,0,1310.792231,1957.576268
2,1,1,1,10621.60998,18588.46812
3,2,1,1,3042.093381,5484.728615
3,2,1,1,3166.358963,5497.289892
3,2,1,0,1481.272986,432.6313548
2,2,1,1,6147.605583,9371.965632
2,1,1,1,14001.79093,16689.25322
3,1,1,1,2035.685768,530.211881
2,1,1,1,6356.258972,1899.874476
3,2,1,0,1487.104781,2018.636444
2,1,1,0,5002.553584,1364.125425
2,2,1,1,2493.79145,4039.542597
3,2,1,0,2260.257377,3495.675613
2,2,0,1,9358.048737,2835.543292
3,2,1,1,2978.506348,4932.378916
3,2,1,1,2794.906054,5118.430973
3,1,1,0,1663.418821,519.7549258
3,2,1,0,2083.459361,3067.105973
2,1,1,0,5106.785048,8672.202644
3,1,1,1,3447.574748,854.6276748
3,2,1,1,2819.233426,899.849234
3,2,1,0,4067.38684,6463.15598
3,2,1,1,1249.96647,2053.666234
3,2,1,1,1730.237908,3058.307502
3,2,1,1,4932.936202,1479.55826
; RUN;
/*PROC TTEST plots=none data=have;
CLASS TM_group;
VAR ACC_HCTROUBL_r ACC_HCDELAY_r;
WEIGHT PUFFWGT;
REPWEIGHT PUFF001; /*REPWEIGHT PUFF001-PUFF100;*/
RUN;*/
PROC SURVEYFREQ data=have VARMETHOD = brr (fay=.30);
TABLE ACC_HCTROUBL_r ACC_HCDELAY_r * TM_group / row chisq lrchisq;
WEIGHT PUFFWGT;
REPWEIGHT PUFF001; /*REPWEIGHT PUFF001-PUFF100;*/
WHERE ADRD_group ^= 1;
RUN;
... View more