BookmarkSubscribeRSS Feed
kcevans
Calcite | Level 5

I have posted a before and after look. 

In the after I have highlighted the formula I am trying to create. 

Trying to not only do a variance line but also a YTD variance..

So right now we are in period 5 (Oct) Next time I run it I will be in period 6 (Nov)

I am not at all sure what formula to use.. I have tried an iif statement and that didn't work..

help please.


After.JPGBefore.JPG
2 REPLIES 2
Rick_SAS
SAS Super FREQ

To a statistician, variance is always positive. It looks like you are just subtracting one year from another.  (That might be the way accountants define variance, I don't know.) 

 

The formulas for most descriptive statistics in SAS are in the documentation.

Recall that if you have n nonmissing values, you can compute the variance of those numbers by 

1) Compute the mean Xbar.

2) Compute the n deviances: x[i] - Xbar

3) Sum the squared deviances: sum( (x[i] - Xbar)**2)

4) Divide by n-1

 

It's not clear to me what you are trying to accomplish. For what number are you trying to find the variance? The differences?

kcevans
Calcite | Level 5

Thank you so much for your reply!

Sorry new here I just now saw that you replied. 

 

In the first spreadsheet "Before" I don't have the variance as displayed in "After" which definition for variance (highlighted in yellow) for this purpose being:

 

Fiscal year 2017 (Periods) Diamonds - Fiscal Year 2016 (Periods) Diamonds = how many more/less diamond orders we have for the current period "month" in correlation to the same period last year.

Also, Fiscal year 2017 (Periods) Pearls - Fiscal Year (Periods) 2016 Pearls = how many more/less Pearl orders we have for the current period "month" in correlation to the same period last year.

 

But I only want the variance to display through current period I don't want it to calculate for months that have not occurred yet.  So for example period 6 (November) has not occurred yet so it would be blank (See After example highlighted in yellow).

 

This is easy for me to do in an excel spreadsheet but I need to build it in Enterprise Guide. 

Thank you again for all your assitance!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1122 views
  • 1 like
  • 2 in conversation