N/A
Posts: 0

# Summary Statistics in SAS

Hello ,

I have a monthly data divided into four week period.I wnat to produce the summary stats that contains the information on the no. of units sold of two kinds of LaptopModels FOR EACH WEEK.

I used code -

PROC FREQ Data = sales;
TABLES LaptopModel * UnitsSold ;
RUN;

where the data sles is the data merged for the two periods time (1/11/2009 – 14/11/2009) & (15/11/2009 – 28/11/2009). This code gives me the no. sold over entire month , but I want to have a braekdown for every week of the month.

Table of LaptopModel by UnitsSold

LaptopModel UnitsSold

Frequency|
Percent |
Row Pct |
Col Pct | 1| 2| 5| Total
---------+--------+--------+--------+
AP3965 | 276 | 29 | 7 | 312
| 64.94 | 6.82 | 1.65 | 73.41
| 88.46 | 9.29 | 2.24 |
| 73.60 | 76.32 | 58.33 |
---------+--------+--------+--------+
AT3600 | 99 | 9 | 5 | 113
| 23.29 | 2.12 | 1.18 | 26.59
| 87.61 | 7.96 | 4.42 |
| 26.40 | 23.68 | 41.67 |
---------+--------+--------+--------+
Total 375 38 12 425

Kindly guide.

Regards ,
markc
Super Contributor
Posts: 281

## Re: Summary Statistics in SAS

If there is a variable in the data set that contains the week, then all you need to do is sort by week and then add BY WEEK; into your PROC FREQ code.
Super Contributor
Posts: 3,176

## Re: Summary Statistics in SAS

A prior post / reply recommended you consider SAS techniques (function like INTNX) to derive a start-of-week variable from which you can generate this type of analysis. With the new week-start variable, you can app

Another pair of functions would be to use the YEAR and WEEK functions to extract these two components from a date-variable to use with your analysis.

Scott Barry
SBBWorks, Inc.

http://support.sas.com/forums/message.jspa?messageID=32184
Discussion stats
• 2 replies
• 106 views
• 0 likes
• 3 in conversation