Hello,
I am running a bunch of frequencies on outcomes by date, and I need the frequencies to appear by date in weeks instead of daily. I need the outcomes to appear with the week date labeled -- for example, "03/15/2020, Outcome X, Outcome Y. "03/22/2020, Outcome, X, Outcome Y', etc. I tried the "week" command (see below), but that just numbers the weeks and doesn't put them into an easy to read format.
data covidzip7; set covidzip6; rdate_wk = week(rdate, 'v'); format rdate_wk mmddyy10.; run; proc freq data = covidzip7; tables rdate_wk*race_new*agecat; run;
Can anyone help? Thanks!
I assume you want the first day of the week to be used (3/15/2020). This code will turn every date into the first day of the week, using the INTNX function.
data covidzip7;
set covidzip6;
rdate_wk = intnx('week',rdate,0,'b');
format rdate_wk mmddyy10.;
run;
proc freq data = covidzip7;
tables rdate_wk*race_new*agecat;
run;
I assume you want the first day of the week to be used (3/15/2020). This code will turn every date into the first day of the week, using the INTNX function.
data covidzip7;
set covidzip6;
rdate_wk = intnx('week',rdate,0,'b');
format rdate_wk mmddyy10.;
run;
proc freq data = covidzip7;
tables rdate_wk*race_new*agecat;
run;
This worked - thank you so much!
Start a new thread of your own.
Describe your issue.
Post example data in usable form (data step with datalines, you can find thousands ofe xamples here on the communities).
Show expected results.
Most importantly, show what you have already tried so far. We are glad to assist when people run into problems, but we won't do others work for free.
If you need someone to do your work for you, hire a consultant.
Hi Kurt,
I don't want anyone to do my homework for me, why you assumed that?
But my problem is that we do 2 , 3 chapters a week and no matter how much i tried i always behind.
So in order to do my homework i need to understand how to do it which i don't yet hence asking for help.
Anyway thank you for you reply.
Follow the advice given by @Kurt_Bremser and people will help you. He said:
Start a new thread of your own.
Describe your issue.
Post example data in usable form (data step with datalines, you can find thousands ofe xamples here on the communities).
Show expected results.
Most importantly, show what you have already tried so far.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.