Thanks so much @Reeza and @s_lassen
I am very new to SAS, so my apologies if my questions are very basic.
It seems to me that both of you are suggesting pretty much similar solutions. I tried to use what you suggested and wrote the code below (The name of my monthly dataset that I want to convert to daily is YouGov. The year variable is named year, the month variable is named month, and the advertising expenditure variable is named TV). When I run the code I get two errors. Below is my code:
data Daily;
set Yougov;
date=mdy(month,1,year);
format date date9.;
n_days=day(intnx('month',date,0,'E'));
daily=TV/n_days;
do date=date to date+n_days;
output;
end;
Below is the error:
56 data Daily;
57 set Yougov;
58 date=mdy(month,1,year);
59 format date date9.;
------
48
ERROR 48-59: The format $DATE was not found or could not be loaded.
60 n_days=day(intnx('month',date,0,'E'));
61 daily=TV/n_days;
62 do date=date to date+n_days;
-
133
ERROR 133-185: A loop variable cannot be an array name or a character variable; It must be a
scalar numeric.
63 output;
64 end;
One last point is that, as I said before, this dataset includes several brands (so I have a column named BrandName), and I want to convert the monthly ad expenditure of each brand into daily ad expenditure. Shouldn't the column "BrandName" be somehow included in the code.
Thanks so much again and my apologies if the questions are too basic.
... View more