BookmarkSubscribeRSS Feed
xxartpopxx
Fluorite | Level 6

I am looking to output an excel file from SAS where one column contains my variable provider_type and the other column contains the mean of each provider type. There are 5 different provider types that all have a mean. I also need to include another column in the excel that contains the weekly date that shows the means changing over time. My date variable is admin_dt_1. Is there a way to do this? Do I need to use proc sql? Again one column needs to have the provider_type, another the mean of each provider, and the weekly date October1st-7th.

Provider Type=Mean(Number of People who had been vaccinated at that location) Date Vaccine Administered=admin_dt_1.

Example of what I want Data table to look like: MVT Provider type, Mean=40.0%, Week: October 1st-7th

So far my code is:

Ods excel file="...." proc freq data=dash; tables provider_Type;run; ods excel close.

I'm just getting what is below. I want to include another column that shows weekly date with the percents. Provider %mean Community 40%
MVT 10% PH 2% Sales 5& R 43%

2 REPLIES 2
Reeza
Super User
We still need example data....
ballardw
Super User

Some example data would be nice. Input and what you expect as result for that. An actual appearance is helpful as a verbal description can be interpreted multiple ways.

Do you have a SAS data set yet? Is your "date" and actual SAS date value or something else?

 

SAS has functions and formats that use SAS date values to return information about week depending on a couple of different rules depending on first day of week as Sunday or Monday and how to indicate week for end/beginning of year when a week starts or ends in a different year.

 

Given an incomplete data description this is something I would start with:

proc freq data=dash; 
   tables admin_dt_1 provider_Type;
   format admin_dt_1 yymon. ;
run

The format YYMON will display dates as year and three-letter month abbreviation. If that throws an error or has values that don't make sense then like the values of the date variable have to be addressed. That will give us a starting point for getting your details.

 

Suggestion: it would be quite a bit easier to show just the first day of the week then trying to show a range

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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