I am currently analyzing the impact of an intervention on medication numbers using difference-in-difference analysis, but I have encountered several problems. Following the SAS support instructions, I conducted the difference-in-difference analysis. However, I noticed a discrepancy between my results and SAS's example 61830. In the example, the value of 'Mean Estimate' in 'Contrast Estimate Results' is identical to the 'Estimate' in 'Least Squares Means Estimate'. However, in my case, these values were different. I suspect this could be due to my use of the negative binomial distribution with a log link, resulting in exponential values. Consequently, I am unsure whether to rely on the 'Mean Estimate' in 'Contrast Estimate Results' or the 'Estimate' in 'Least Squares Means Estimate', and how to interpret this results. Thank you very much. Here is my result: Contrast Estimate Results Label Mean Estimate Mean Confidence Limits L'Beta Estimate Standard Error Pr > ChiSq diff in diff 1.51 1.49-1.52 0.41 0.0051 <.0001 time*intervention Least Squares Means time intervention Estimate SE z value Pr > |z| 1 1 0.77 0.00434 178.19 <.0001 1 0 0.03 0.00508 6.5 <.0001 0 1 0.72 0.00408 177.71 <.0001 0 0 0.40 0.00426 93.11 <.0001 Least Squares Means Estimate Effect Label Estimate SE Z value Pr > |z| time*intervention diff in diff 0.41 0.00509 81.01 <.0001 SAS code: proc genmod data = ALL_DID;
class _MatchID intervention time /ref = first;
model drug_use = time intervention time*intervention/dist = negbin link=log;
repeated subject =_MatchID/type = exch;
estimate "diff in diff" time*intervention 1 -1 -1 1;
lsmeans time*intervention;
lsmestimate time*intervention "diff in diff" 1 -1 -1 1;
run;
... View more
data vs ; input patient cpevent$ vstest$ vsren vsorresu$; cards ; 100 base pr 78 min 100 scrn hr 72 /min 100 week1 sbp 70 mmhg 100 week7 dbp 110 mm 100 week21 weight 75 kg
100 fwp height 120 kg 100 base pr 78 min 100 scrn hr 79 /mn 100 week1 sbp 70 mmhg 100 week7 dbp 110 mm 100 week21 weight 80 pounds
100 fwp height 75 kg ;
Condition below
If VSTEST having same VSREN and VSORRESU for 4 consecutive visits then highlight those with flag as
"dulipcate record"
Based on above condition and data , create a flag
Please anyone help me .....
... View more
I trying to create a stacked bar chart comparing MA and TM groups on 8 different binary variables (I've only shown 2 here for simplicity) and 1 discrete (0-8) continuous variable. I've created a chart for the continuous variable, and it's pretty close to what I need. Here's what I need to change:
1) The bars are the same color, so it's not clear which group is higher/lower.
2) I'd like to add the name of the group that goes to each color.
3) I need to replace the variable name total_qual_care_score with a label such as "Total Quality of Care Score".
For the binary variables, I'd like to have both in a single chart. I haven't been able to create an example chart, but imagine that only the 0 and 1 bars exist. And instead of 0 and 1, the columns represent ACC_HCTROUBL_r and ACC_HCDELAY_r (with the labels "Trouble getting care" and "Delay in getting care", respectively).
Here's my current code with sample data:
data have;
infile datalines dsd dlm=',' truncover;
input Obs cohort_flag MA_non_ADRD_group TM_non_ADRD_group total_qual_care_score ACC_HCTROUBL_r ACC_HCDELAY_r;
datalines;
1,1,1,0,7,1,0
2,1,0,1,7,0,1
3,1,0,1,7,1,0
4,1,0,0,1,0,1
5,1,0,0,8,0,1
6,1,0,1,7,0,1
7,1,0,1,3,1,0
8,1,0,1,7,0,1
9,1,0,1,8,1,0
10,1,1,0,5,0,1
11,1,1,0,8,0,0
12,1,0,1,8,1,1
13,1,1,0,8,0,1
14,0,,,7,0,1
15,1,0,1,8,0,1
16,1,0,1,8,0,0
17,1,1,0,8,0,1
18,1,0,0,7,0,0
19,1,1,0,8,1,0
20,1,0,1,6,0,1
21,1,0,1,7,1,1
22,1,1,0,7,0,0
23,1,0,1,5,1,0
24,1,0,1,8,0,1
25,1,0,1,8,0,1
; RUN;
title1 "Section 1.2 -- Fig1 Unadj rates quality care TM vs MA without ADRD";
title2 "Version &version.";
PROC MEANS data=have mean n lclm uclm stackods;
class total_qual_care_score;
var TM_non_ADRD_group MA_non_ADRD_group;
ods output summary=temp.TM_MA_groupMean;
WHERE cohort_flag = 1 AND (TM_non_ADRD_group = 1 OR MA_non_ADRD_group = 1);
RUN;
PROC SGPLOT data=temp.TM_MA_groupMean;
vbarparm category=/*variable*/ total_qual_care_score response=mean /
limitlower=lclm
limitupper=uclm;
label mean="Proportion satisfied";
RUN;
... View more
Hi guys,
suppose to have the following:
data DB1;
input ID Discharge;
format Discharge date9.;
cards;
0001 19JUN2017
0001 07SEP2020
0002 17MAR2016
0003 05MAY2016
0003 08FEB2017
0004 22MAR2017
0004 03MAY2017
0004 28MAR2021
;
data DB2;
input ID Discharge Flag NewDate;
format Discharge NewDate date9.;
cards;
0001 19JUN2017 0 .
0001 07SEP2020 1 08SEP2020
0002 17MAR2016 1 18MAR2016
0003 05MAY2016 0 .
0003 08FEB2017 1 09FEB2017
0004 22MAR2017 0 .
0004 03MAY2017 0 .
0004 28MAR2021 1 29MAR2021
;
Is there a way to add a flag to DB1 where for each ID there's the latest date (if there is only one date as for ID 0002 the last date will be the one reported) and then add the new date corresponding to the last + 1 day? Desired output: DB2.
Thank you in advance
... View more
Hi all,
At https://developer.sas.com/apis/rest/v3.5/#filters there is supposed to be a link that explains filter expressions:
For a complete description of filter expressions, see the Filtering reference.
However, when clicking this link (on the word "Filtering") I do not see any such page. It looks like this "got lost" during the switch to the new developers.sas.com web site.
Anyone knows where can I find the doc about API filter expressions?
... View more