This channel is created for all the people who wants to improve their SAS skills, or preparing for SAS interviews or for SAS certification. This channel is containing guidance for below topics: SAS interview questions and answers SAS tutorial for beginners and experienced SAS Training
The video is awesome .. please keep creating this way more videos on various procedures in SAS. Syntax with examples of Proc univariate, Proc tabulate etc.
No, Because character variable can handle any value. However numeric variable has a limit to use 0-9 values only. However you can achieve this cusing an array of _character_ type.
proc sql; create table grouped_data as select ceil(ball/6) as over, sum(coalesce(run, 0)) as total_run from ungrouped_data group by ceil(ball/6); quit;
Good Attempt. However suppose if balls are 600 then you have to hardcode 100 overs in formats. So this approach will not work dynamically, as total balls can be changed. So try solving this using only one data step. You can use underscore N underscore with combination of mod function.
@@sasworld2021 how about this proc sql; create table have as select ceil(balls/6) as overs, sum(runs) as runs from cricket group by ceil(balls/6); quit; data have2; set have; by overs; if first.overs then output; run;
data want; set given; if _n_<=6 then over=1; if 6<_n_<=12 then over=2; if 12<_n_<=18 then over=3; run; data last(keep=over total_runs) ; set want; by over; if first.over then total_runs=runs; else total_runs+runs; if last.over; run;