Hello
I want to create a proc report.
In x-axis there will be one categorical var "group"
In Y-axis there will be two categorical variables "date1" "NameDay".
in the cells of the table there will be sum of Y
Please note that in each column I want to have both date and name of day .
I don't want that the name of the day will be on multiple cells.
Data RawTbl;
informat date1 date9.;
format date1 date9.;
input ID date1 Y group $;
NameDay = put(date1,dowName. -l) ;
cards;
1 '15Jan2019'd 10 a
2 '17Jan2019'd 20 a
3 '19Jan2019'd 30 a
4 '21Jan2019'd 40 b
5 '23Jan2019'd 50 b
6 '18Jan2019'd 60 b
7 '17Jan2019'd 70 c
8 '08Jan2019'd 80 c
9 '04Jan2019'd 90 c
;
Run;
Do you mean something like this:
proc transpose data=rawtbl out=trans;
by date1 notsorted nameday notsorted;
id group;
var y;
run;
proc report data=trans;
column date1 nameday a b c;
define date1 /group;
define nameday /group;
define a /analysis;
define b /analysis;
define c /analysis;
run;
When for same date there are multiple customers who belong to same group then it give an error
Data RawTbl;
informat date1 date9.;
format date1 date9.;
input ID date1 Y group $;
NameDay = put(date1,dowName. -l) ;
cards;
1 '17Jan2019'd 10 a
2 '17Jan2019'd 20 a
3 '19Jan2019'd 30 a
4 '21Jan2019'd 40 b
5 '23Jan2019'd 50 b
6 '18Jan2019'd 60 b
7 '17Jan2019'd 70 a
8 '08Jan2019'd 80 c
9 '04Jan2019'd 90 c
;
Run;
proc transpose data=rawtbl out=trans;
by date1 notsorted nameday notsorted;
id group;
var y;
run;
In x-asix (rows) need to have groups (a,b,c)
In y-axis need to have date and under it name of day
Thank you very much.
However, the location of fields should be different.
In rows need to have groups (3 rows for categories: a,b,c)
In columns need to have date and under it name of day
Please supply a visual example of the expected report you want to have out of your second example dataset.
Please see my new post .thanks
I don't see a new post, please provide a link.
I see a similar old post of yours, which does NOT provide the requested VISUAL example of what you want.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.