I have data with several variables including store_id, location, and product_cat. Store_Id ranges from 1-8, location ranges from 1-9 (representing outside, entrance etc.), and product_cat ranges from 1-8 (representing candy, cereal, etc). I need the mean number of "displays/counts" per store by location and product_cat. I'm unsure how to transform this data to get the correct information.
Please show how the data is arranged now, as in a SAS data step. Then are layout of what the desired results would look like.
Help us help you.
Try a summary procedure such as PROC MEANS/SUMMARY.
You can add multiple variables into the BY statement, and SAS will break down the analysis by the variables in the BY statement.
Basic tutorials/demo is here:
This is great, thank you! Quick question-I am not reporting by store. My table shells look like this:
Food Product Categories
Fruits and Vegetables
I am confused as to what to report. I can't just take the "by STORE_ID;" out.
Post some sample data and your expected output. Please post as a data step, see instructions here:
You can also google a paper called ‘creating complex reports’ by Cynthia Zender that walks through how to create presentation ready tables.
I'm having a hard time getting this to work. I have SAS version 9.4. I downloaded the macro and have it opened in my SAS; I don't use macros that are this complicated very often, so it's a bit confusing. Do I edit the top line?
Top of the post:
%data2datastep(dsn, lib, file, obs);
dsn = input data set name, required
lib = library where input data set resides, optional
file = name of output file, optional
obs = number of obs to include in the data step, optional
Lib, the second parameter is the library where the data set is stored. I'm assuming your data set is not in the SASHELP library but most likely the WORK library. Just leave it empty and it should work.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.