Presentation is loading. Please wait.

Presentation is loading. Please wait.

Application of SAS Software at NSPI presented by Voytek Grus Pricing Specialist, Marketing Dept. for SAS user group, Halifax March 11, 2005.

Similar presentations


Presentation on theme: "Application of SAS Software at NSPI presented by Voytek Grus Pricing Specialist, Marketing Dept. for SAS user group, Halifax March 11, 2005."— Presentation transcript:

1 Application of SAS Software at NSPI presented by Voytek Grus Pricing Specialist, Marketing Dept. for SAS user group, Halifax March 11, 2005

2 NSPI in brief Vertically integrated Power Company under the allowable rate of return regulation : –450,000 customers, $1 billion revenues, 1700 employees –Costs of service are subject to regulatory scrutiny. –Need regulatory approval to set prices Drivers behind information needs: –Operational and strategic decision making. –Regulatory requirements. –Industry trends: deregulation of the industry Complex pricing arrangements Energy conservation

3 SAS application at NSPI: Purpose and resources Purpose –To meet analytical information needs of marketing and regulatory departments through supporting to cost of service studies. testing bill impacts of price changes To meet marketing data mining needs Resources –2 licenses but only one active user. –Products used: Version 8.0, Base SAS/ACCESS/ASSIST/FSP/GRAPH/STAT –1 desktop machine, double pentium processor: 864 MHz each, 1 Gigabyte of RAM, 66 GIGs of hard drive memory. –Pricing specialist spends about 20% of his time working in SAS to provide information.

4 Philosophy behind SAS applications Meet the objective of satisfying company’s information needs in a timely and cost-efficient manner through the means of A right balance between SAS and Excel applications. Permanent storage of some operational data records in SAS datasets Extract value from a careful database design Disciplined approach to the code development.

5 Philosophy behind SAS applications: tap into a symbiotic relationship between SAS and Excel Will not shy from moving back and forth between SAS and Excel if it speeds up the process using these two procedures: PROC IMPORT OUT= WORK.index3 DATAFILE= "K:\VJG\Projects\Unmetered\MeteredTrafficLights.xls" DBMS=EXCEL2000 REPLACE; RANGE="MetTrafficL"; GETNAMES=YES; RUN; PROC EXPORT DATA= WORK.test OUTFILE= "K:\VJG\Rate Case 2005\Bill Impacts\cmesmall.xls" DBMS=EXCEL2000 REPLACE; RUN;

6 Philosophy behind SAS applications: permanent databases Maintain several databases: –Monthly billing records: Customer consumption records (17 millions) –Has a unique premise index (for the rate design studies) maintained by the billing dept. Customer information records (1 million) –Hourly consumption data for a few hundred customers on load research sample (6 million) –Various hourly costs production data (hundred of thousand records)

7 Database maintenance: reading-in text file records can be a challenge for beginners Text files read in in the SAS data step filename FileList &source; infile FileList; Example of test data structure read in the data step

8 Database maintenance: useful code for reading-in text files : %let sourcedir=‘C:\Load Research\'; %let source=‘C:\Load Research\dir.txt'; data example; filename FileList &source; infile FileList; length filename_prn $ 12 PRNname $ 89; input filename_prn 40-51; PRNname = &sourcedir || filename_prn; infile PRNname filevar = PRNname end = done firstobs = 2; do until ( done ); input lrid $ 2-15 date $ 18-23 hour $ 25-26 min $ 27-28 kwhs_lr 40-50; keep filename_prn lrid hourlydate kwhs_lr; output; end; run; proc expand data=nsr out=nsr from=hour to=hour; convert nsr tsr exports / method=join; id hourlydate; run; Find these statements very useful Will use expand procedure to deal with missing observations.

9 Database maintenance: “update”, “index” and “where” statements data mf.static; update mf.static static; by rc premise account name; run; proc datasets lib=mf; modify static; index create premise; index create rpan=(rc premise account name); run; data ExtractRecord; set mf.static; where premise=100; run; Use “where” statement to extract a data records for premise #100 Creates indices for big databases to access records efficiently Use “update” statement to update database by key indices.

10 Philosophy of SAS application at NSPI: invest time in careful database design. Database design is a key for an efficient code writing: –The fewer variables the the better: –Example of efficiency gain in aggregation: This design is more preferable … than this proc means data=input sum noprint; by voltage class hour; var KWhs; output out=output sum=; run; data aggregate; set input; Kwhs_all=KWhs_res_di st+ KWhs_res_comm_ +...etc; run; This data structure lends itself to more efficient processing

11 Philosophy of SAS usage at NSPI: modular approach to SAS code. Delegates specific tasks to SAS programs invoked by %include statement from the master program: /*** SECTION I Bottom-Up Calc. Prepare raw load shapes by rate and voltage classes */ %include 'C:\PROGRAMMS\LSbyRCL1.1 Prepare Accrued Classes.sas'; %include 'C:\PROGRAMMS\LSbyRCL1.2 Prepare Large Customers.sas'; %include 'C:\PROGRAMMS\LSbyRCL1.3 Extract NSR.sas'; %include 'C:\PROGRAMMS\LSbyRCL1.5 Combine and scale to oracle rc shapes.sas'; %include 'C:\PROGRAMMS\LSbyRCL1.6 Combine rc into vc shapes.sas'; /*** SECTION II Top-Down Calc. Calibrate line losses by Voltage Classes */ %include 'C:\PROGRAMMS\LSbyRCL2.1 Calc Line losses by vc.sas'; etc....

12 SAS programming philosophy at NSPI: standard naming convention, use of global parameters. Extensive use of global parameters (macros) %let Juan1=dhms(mdy(9,29,2003),0,0,0); /* adj for the huricane */ %let Juan2=dhms(mdy(10,5,2003),23,0,0); … …. data nochange Juan_rpl; set alldata; if (hourlydate &Juan2) then output nochange; if (hourlydate >= &Juan1-(&Juan2-&Juan1)-3600 and hourlydate < &Juan2- (&Juan2-&Juan1)) then output Juan_rpl; run;

13 SAS applications: Cost of Service Studies NSPI is mandated to provide cost of service studies to the regulator Studies determine cost of service to over a dozen customer groups such as residential, commercial industrial rate classes. Need to determine hourly consumption patterns (Load Shapes of 8760 hours) by various groups before costs can be allocated. Simplified Diagram: Hourly Load Research Data for 700 customers (6 million records in MV90 db) Load Research Dept. Calculates sample weights using Customer monthly billing records. ( 5 million recs in SAS db)) Marketing Dept. Calculate Hourly Sales patterns for 7 rate classes (in MV90 db) (Load Research Dept) Econometric Load forecast Projects monthly sales by rate class. (Excel) (Marketing Dept) Calculate hourly sales, losses, requirements by rate class to arrive at cost allocation stats such as coincident and non-coincident peak. (SAS) Allocation of Costs to rate classes (Excel) (Regulatory Dept)

14 SAS application: Contribution to Cost of Service Studies

15 SAS Applications: Customer Bill Impacts Changes in prices are subject to regulatory approval and need to be communicated to NSPI Management, the UARB and customers of NSPI. Revenue Deficiency (Finance Dept. ) Allocation of costs among customer classes (Regulatory Dept. ) Allocation of cost responsibilities s among customer classes (Marketing Dept. ) Rate Design: Allocation of cost responsibilities among individual customers (Marketing Dept. ) Will test bill impacts of proposed rate structure on all customers using SAS (Marketing Dept. ) Are bill impacts acceptable to NSPI, UARB, Customers? No Yes Submit new tariffs Give Customers access to bill impacts on the internet

16 Bill Impacts – an example of final Output for the UARB

17 Bill Impacts – Final Output for NSPI customers available on the NSPI website in 2002. Screen #1: enter personal info. Screen #2: customized bill impact.

18 Customer Bill Impacts – programming solutions To simulate bills use pointer technique to keep the size of work-in-progress data files at a minimum: data M_&method&type&scenario /*(keep=rc premise year month simrev);*/ (drop= code min_bill ratecode montht yeart pos tc base_ch demand_on_ch demand_off_ch kwh_blk1_ch); set dets_&type&scenario; %include 'C:\Programms\Bill Simulation 1.2.1 Calc Bill.sas'; pointer=((year-&ftyear)*12+month-1)*32+pos; set tariffs.M_&scenario point=pointer; if index(bf,'T')=0 then tc=0;else tc=&toc; if rc in (2 3) and index(bf,'P')> 0 then select; when (rc=2) pos=1; when (rc=3) pos=2; when (rc=4) pos=3; when (rc=5) pos=4; when (rc=6) pos=5; when (rc=7) pos=6; when (rc=8) pos=7; when (rc=9) pos=8; when (rc=10) pos=9; Etc …

19 Customer Bill Impacts – programming solutions To calculate accrued monthly records will use arrays and will split datasets into smaller subsets to speed up processing of files which otherwise could reach undesirable size of dozens of millions of records. data accrsort1(drop=i) accrsort2(drop=i); /* Rearrange data in preparation for aggregation */ set billed_partitioned; array kwhsblk1{6} kwhsblk11-kwhsblk16; array kwhsblk2{6} kwhsblk21-kwhsblk26; etc... do i=1 to 6; year=year(datex{i}); month=month(datex{i}); kwhs_blk1=kwhsblk1(i); kwhs_blk2=kwhsblk2(i); etc... if i <=3 then output accrsort1; else output accrsort2; end; run;

20 Price Studies: Finding a time pattern for pricing structures. Use a “by group” processing feature of graph and regression procedures to efficiently analyze data.

21 Price Studies: Finding a time pattern for pricing structures. Example of a “by group” processing feature of a Regression procedure …. %let regress_by=year month daytype; proc sort data=input_data out=output_data; by &regress_by; run; proc reg data=output_data outest=regstats tableout; by &regress_by; m1: model NSR = mid_peak1 on_peak1; m2: model NSR = on_peak2; m3: model mc = on_peak2; run; data m1_coeff(keep=&regress_by intercept mid_peak1 on_peak1 rename=(intercept=intercept1 mid_peak1=mp1c on_peak1=op1c)) m2_coeff(keep=&regress_by intercept on_peak2 rename=(intercept=intercept2 on_peak2=op2c)) m3_coeff(keep=&regress_by intercept on_peak2 rename=(intercept=intercept3 on_peak2=op3c)); set regstats; if _type_='PARMS' and _model_='M1' then output m1_coeff; if _type_='PARMS' and _model_='M2' then output m2_coeff; if _type_='PARMS' and _model_='M3' then output m3_coeff; run; …

22 Employs SAS graph capabilities to assist Large Customers in their planning process.


Download ppt "Application of SAS Software at NSPI presented by Voytek Grus Pricing Specialist, Marketing Dept. for SAS user group, Halifax March 11, 2005."

Similar presentations


Ads by Google