Thoughts of a Crime Show Junkie: Inadmissible Evidence
Recent Library Articles
Recently in the SAS Community Library: SAS' @RhondaWilliams reveals how SAS Law Enforcement Intelligence helps law enforcement agencies expedite detailed data entry using the Evidence Creation feature.
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
Hi, I'm currently merging multiple datasets and consistently using the following SQL code to verify there are no duplicate IDs at each stage of the process: proc sql; select count(distinct ID) as UniqueIDs, count(*) as NObs from dataset; quit; This approach effectively identifies duplicates when datasets have multiple timepoints, and I make sure to only select one timepoint per ID. Throughout the merging process, my checks confirm that all IDs remain unique (e.g., 1500 observations and 1500 unique IDs). However, after the final merge, the same SQL query unexpectedly shows 1500 observations but only 1300 unique IDs. Manual verification confirms that duplicates are present, despite prior checks showing no such issues. I'm looking for insights into why these duplicates weren’t detected sooner by the SQL query, or if there's a specific merging condition I might have overlooked. Edited to add: The SQL code above is the one that I use to check each dataset for duplicates (which it seems to find pretty well) and after each merge. Merge code (throughout and also the last one): data merged_dataset; merge dataset1 dataset2; by ID; run; Attaching the LOG for the last merge + SQL check. The result for this was 1181 UniqueIDs and 1229 NObs, while previously I was getting 1229 UniqueIDs and 1229 NObs. LOG for the last merge + SQL check
... View more
I am currently analyzing the impact of an intervention on medication numbers using difference-in-difference analysis, but I have encountered several challenges. Following the SAS support instructions, I conducted the difference-in-difference analysis. However, I noticed a discrepancy between my results and SAS's example (Usage Note 61830: Estimating the difference in differences of means). 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 the results." Contrast Estimate Results Label Mean Estimate Mean Confidence Limits L'Beta Estimate Standard Error diff in diff 1.51 1.49 0.41 0.0051 a*b Least Squares Means a b Estimate Standard Error 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 Estimation Standard Error z value Pr > |z| time*hospitalize diff in diff 0.41 0.00509 81.01 <.0001
... View more
Hi, Can anybody help me with formatting the datetime correctly in my program? I am mostly getting blank columns or getting the date as 01Jan1960:9:25:00 Etc. Here's the code I am using data x; set x; y_new = input(y, andtdtm.); format y_new datetime22.; run; And here's how some values in the datetime column look like when imported into SAS: 45348.3506829051 45349.8328009028 45350.7706134028 Thank you! Best regards, Abhishek
... View more