From: siddharth khanna on
Hello ,

I have to goods - Pepsodent ( P) and Colgate(C). the units of P sold
over periods 1 and 2 are 140 and 229.For the 'C' the units sold in
period 1 and period 2 are 71 for each period.


proc univariate data = "C:\Sas\sales";
HISTOGRAM UnitsSold/NORMAL;
INSET N = 'Product Units sold';
Where Product='Colgate';
RUN;

I want to get the histogram for the number sold in each period . The
datafile "sales" has the Variable "Period" divide into Period 1 and
Period 2 and the Units Sold.When I use the code above it only adds the
number of rows that have product 'C' in it but I want the number of
units sodl of C.


Kindly suggest what I should do.

regards,
siddharth
From: Richard A. DeVenezia on
On Mar 10, 11:50 pm, siddharth khanna <khanna_si...(a)yahoo.com> wrote:
> Hello ,
>
> I have to goods - Pepsodent ( P) and Colgate(C). the units of P sold
> over periods 1 and 2 are 140 and 229.For the 'C' the units sold in
> period 1 and period 2 are 71 for each period.
>
> proc univariate data = "C:\Sas\sales";
>         HISTOGRAM UnitsSold/NORMAL;
> INSET N = 'Product Units sold';
> Where Product='Colgate';
> RUN;
>
> I want to get the histogram for the number sold in each period . The
> datafile "sales" has the Variable "Period" divide into Period 1 and
> Period 2 and the Units Sold.When I use the code above it only adds the
> number of rows that have product  'C' in it but I want the number of
> units sodl of C.
>
> Kindly suggest what I should do.
>
> regards,
> siddharth

Siddarth:

Use
INSET SUM=
instead of
INSET N=

You might also want to use a CLASS statement.

---------------
data have;
input Period Product $ UnitsSold;
datalines;
1 P 140
1 C 71
2 P 229
2 C 71
run;

proc univariate data=have;
HISTOGRAM UnitsSold/NORMAL ;
INSET SUM = 'Product Units sold';
CLASS product period;
run;
---------------

Richard A. DeVenezia
http://www.devenezia.com