BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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;
7 REPLIES 7
Kurt_Bremser
Super User

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;
Ronein
Meteorite | Level 14

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;
Ronein
Meteorite | Level 14

In x-asix (rows) need to have groups (a,b,c)

In y-axis need to have date and under it name of day

Ronein
Meteorite | Level 14

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 

Ronein
Meteorite | Level 14

Please see my new post .thanks

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 7 replies
  • 635 views
  • 0 likes
  • 3 in conversation