06-01-2018 11:48 AM
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.
06-01-2018 12:08 PM
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:
06-01-2018 12:21 PM
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.
06-01-2018 12:32 PM
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.
06-01-2018 01:45 PM
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?
06-01-2018 02:22 PM
06-01-2018 04:00 PM
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.