Good morning! I've taken SAS Base Programming 1 and 2, and am working through a few different SAS practice books. Now I have my first work project, and am struggling to find the right direction. My work is tracking fluctuations in confidential quarterly data. With SAS 9.4 (Windows) I need the following results: 1) isolate observations(by accoun) that fluctuate +/- 40% from the prior quarter in four variables(each month plus a total). 2) compare macro changes current to prior quarter, with aggregated changes in those variables +/- 10% by region and SUBJECT variables Here's the last of the code I wrote so far- this is reduced from a massive .txt file to include only relevant variables, I made extensive use of SAS community posts and other online resources to get this far. /*this creates new variables for 2 digit,3 digit level SUBJECT codes, MONTH totals, and percent of quarterly SALES change*/
Data practice1_2;
Set practice1_2 (obs=5000);
SUBJ2=substr(SUBJ,1, 2);
SUBJ=substr(SUBJ,1, 3);
ave_TRANS= sum(MONTH1, MONTH2, MONTH3)/3;
pctchng = dif( SALES ) / lag( SALES ) * 100;
label pctchng = "quarterly SALES Change";
quartern=input(quarter, 2.);
pctchngn=input(pctchng, 6.2);
run;
This produces barely useful output, I can manually see changes per observation in a spreadsheet, but its clumsy, and I'm not sure how to get it into manageable output (total observations are approx 300K). On the macro level, 2 and 3 digit subject codes are needed to determine how narrowly/ broadly each subject is analysed. The goal is to produce a report that tracks regional fluctuation and pinpoints which client account is causing it so the individual account can be researched. Sample data with relevant variables is attached. Proc report seems like a good option, but I'm getting bogged down in where to start. I would greatly appreciate any pointers on how to approach this- it feels fairly straightforward, but being new to programming and SAS, my vocabulary obviously has some gaps and perhaps I'm over complicating or looking in the wrong place. Many many thanks! Artifact
... View more