PGStats you are right! Many thanks! The problem was that when i standardized the fraction using: proc stdize data=fraction out=stdFraction sprefix=std; by qtr; var fraction; run; I got this error (i don't know why this didn't work):
proc stdize data=fraction out=stdFraction sprefix=std;
-------
22
76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ADD, DATA, EXTREME, FUZZ,
INITIAL, KEEPLEN, MAXITER, METHOD, MISSING, MULT, NMARKERS, NOMISS, NORM, OUT,
OUTSTAT, PCTLDEF, PCTLMTD, PCTLPTS, PMARKERS, PRINT, PSTAT, QMARKERS, REPLACE,
REPONLY, SNORM, UNSTD, UNSTDIZE, VARDEF.
ERROR 76-322: Syntax error, statement will be ignored.
147 by qtr;
148 var fraction;
149 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE STDIZE used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
So I skipped that and then made a mistake when changed the names in the next query. The next step is to calculate expression M (as shown above) For the first term I have this code: proc freq data= tmp1.example; tables date / out=K noprint; run; proc sql; create table K1 as select date, count, intnx("QTR",date,0) as qtr format=yyqd7.,count-1 as K_1 from K ; quit; proc means data=fraction mean std nway noprint; var fraction; class qtr; output out=want (drop=_:) mean= std= /autoname; run; data a3; set want; set K1 (keep=K_1); frmean_1= lag(fraction_mean); frstddev_1=lag(fraction_stddev); run; data a4; set a3; coefficient= 1/(k_1*fraction_stddev*frstddev_1); run; Do you have any suggestions on making this shorter? Many thanks for your time!
... View more