BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
Paige
Quartz | Level 8
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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1227 views
  • 0 likes
  • 3 in conversation