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 L'Beta Estimate 標準 Confidence Limits 誤差 diff in diff 1.51 1.49 1.52 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
USING THE CODE ALREADY POSTED IN SUNFLOWER EXAMPLE. I HAVE A PROBLEM THE ESTIMATE STATEMENT OR LINE IS NOT WORKING AS IT GIVES AN ERROR "ERROR 180-322: Statement is not valid or it is used out of proper order." WHAT COULD BE THE PROBLEM? I HAVE TRIED SHIFTING THE ESTIMATE LINE TO BE BEFORE THE OUTPUT STATEMENT, STILL IT FAILS. /* Mean heights of 58 sunflowers: Reed, H. S. and Holland, R. H. (1919), "Growth of sunflower seeds" Proceedings of the National Academy of Sciences, volume 5, p. 140. http://www.pnas.org/content/pnas/5/4/135.full.pdf */ data Sunflower; input Time Height; label Time = "Time (days)" Height="Sunflower Height (cm)"; datalines; 7 17.93 14 36.36 21 67.76 28 98.1 35 131 42 169.5 49 205.5 56 228.3 63 247.1 70 250.5 77 253.8 84 254.5 ; proc nlin data=Sunflower list noitprint; parms K 250 r 1 b 40; /* initial guess */ model Height = K / (1 + exp(-r*(Time - b))); /* model to fit; Height and Time are variables in data */ output out=ModelOut predicted=Pred lclm=Lower95 uclm=Upper95; estimate 'Dt' log(81) / r; /* optional: estimate function of parameters */ run;
... View more
Hi, I have a SAS dataset wherein date format is incorrect and the same is to be corrected.
Please help in the matter.
data A; input Employee_Id $ Date Date9. ; cards;
70202028 - 04JAN2023;
70204018 - 04SEP2023;
70172038 - 27MAR2023;
run;
data want;
set a;
70202028 - 01APR2023; /*to be changed*/
70204018 - 09APR2023; /*to be changed*/
70172038 - 27MAR2023; /*this is correct and it should not be changed*/
run;
... View more
Hi I am new to proc template . 1. I am displaying bar value at the top of bar using barlabel=true. How to display the value at the center of the bar instead of top? 2. Also, how to wrap x axis value. text variable have one value very long 3. what option in proc template i can use to display P value at the top. Thanks in advance
... View more
Hello,
I have a dataset that I need to calculate the rolling average and sum. The file is attached. What I intend to do here is to calculate rolling average/sum of variables from -380 days to -20 days (I also require at least 50 non missing observations). The code is below. However, it seems that there are some very large numbers in the output files, starting from around row 800. The ouput number is not consistent with my manual calculation. I guess it might be due to the missing observations. I would like to know what I missed here. Any help is appreciated.
proc expand data = test2 out = test2;
by permno;
id date;
convert logret = logret_new/transformout=(lag 20 movsum 360 trim 70);
convert turnover = turnover_new/transformout=(lag 20 movave 360 trim 70);
convert ret = std /transformout=(lag 20 movstd 360 trim 70);
run;
... View more