How would I be able to create a code for this without using an sql procedure?
Determine the day of the week (Monday to Friday) for which the total observed usage time during the study period was the highest. The result of your procedure should show the days of week only.
I want to have a table with The weekdays and their total of usage time. To do so I have to calculate the sum of the usage time and exclude the weekend days.There are multiple observations for the usage time per day. This is what I have so far:
PROC SUMMARY DATA=NewBixi;
VAR Timeusage;
OUTPUT OUT=Usage SUM=;
BY Day;
RUN;
PROC PRINT DATA=Usage;
ID Day;
WHERE Jour not in("Sunday";"Saturday");
RUN;However; Saturday still shows in my table and I do not want to have the _type_ and _Freq_ columns in my final table.
Thank you for your help!
Please post the data you have in usable form.
I would expect one date variable to be part of the data, allowing the usage of the format-statement in proc summary to get the required aggregation. To remove unwanted variable, use the keep/drop dataset-option in the output-statement of proc summary. The code is, of course, untested:
proc summary data=have nway;
class Day;
var Timeusage;
format Day weekday.;
output out=result(drop= _type_ _freq_) sum=;
run;
Your code will not run. Look at the log.
Please post the data you have in usable form.
I would expect one date variable to be part of the data, allowing the usage of the format-statement in proc summary to get the required aggregation. To remove unwanted variable, use the keep/drop dataset-option in the output-statement of proc summary. The code is, of course, untested:
proc summary data=have nway;
class Day;
var Timeusage;
format Day weekday.;
output out=result(drop= _type_ _freq_) sum=;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.