I have this data I want to loop for find average price every stock name and I write this Proc Sql but it can fine one stock name. please advise me. proc sql;
create table avg_price_30D_work as
select distinct
&batch_date. as data_dt format yymmdd10.,
stk_shrt_nm,
avg(close_price) as avg_price_30D_work
from work.stock_price_cal
where 1=1
and cnt_wk between (select cnt_wk-29 from work.stock_price_cal where 1=1 and DATA_DT = &batch_date. and stk_shrt_nm = "AJ")
and (select cnt_wk from work.stock_price_cal where 1=1 and DATA_DT = &batch_date. and stk_shrt_nm = "AJ")
;
quit;
... View more
Ok real sample data below f1 f2 f3 f4 f5 f6 ... f567 format is f1, f4, f7 = date, f2, f5, f8 = number and f3, f6, f9 = text repeat this until f567 i want arrang data follow my topic. Thank your for advise.
... View more
I have data something like this f1 f2 f3 f4 f5 f6 ... f500 1 2 3 8 4 6 ... 4 I want data 1 2 3 8 4 6 ... How to write sas code? Thank you.
... View more