Hi,
Can I please get some help with this.
The Destination Table contains a list of customers who holidayed last year to DESTINATION Europe, or remained in NZ for their holidays. A customer may have had holidays in both Europe and NZ. The layout for the table is shown below:
I would like to create a report that shows the precentage of customers, who went to Europe last year, but based on Customer_Age:
20 – 29, 30 –39, 40 – 49, 50+.
And the report should only show the Age Range and the Percentage of Customers who went to Europe for their holiday.
How can I implement an Age_Range in this report? Would I be right to do it with
PROC FORMAT?
Something like:
Proc format ;
value Customer_Age;
18 - 29 = ' Age Range 20 – 29’
30 - 44 = ' Age Range 30-39'
45 - 59 = ' Age Range 40 49'
60 - high = ' Age Range 50+';
run;
and then I would start like below, but I am not sure how to link my Age Range . I thought the Proc format creates the Group that I can define and analyse using a computing block. But I am not really sure how it connects.
Help much appreciated
Proc Report Data = Holiday
headline headskip;
title1 "Customer Holiday Report";
COLUMN CUSTOMER_AGE('_Destination_' Destination = pct);
DEFINE CUSTOMER_AGE /GROUP FORMAT=8. ;
DEFINE pct /GROUP FORMAT=8. FORMAT=PERCENT8. ;
RBREAK AFTER /SUMMARIZE UL OL; RUN;
CUSTOMER_NUMBER | CUSTOMER_AGE | DESTINATION |
123 | 27 | NZ |
123 | 27 | Europe |
124 | 42 | Europe |
125 | 33 | NZ |
126 | 45 | Europe |
127 | 60 | NZ |
128 | 45 | Europe |
129 | 62 | Europe |
130 | 33 | Europe |
131 | 58 | Europe |
132 | 34 | Europe |
133 | 49 | Europe |
133 | 49 | NZ |
134 | 33 | Europe |
135 | 45 | NZ |
136 | 60 | NZ |
137 | 45 | NZ |
138 | 62 | NZ |
139 | 33 | NZ |
140 | 45 | Europe |
141 | 60 | Europe |
142 | 45 | Europe |
143 | 62 | Europe |
144 | 33 | Europe |
You can create a dataset from your proc means:
proc means...; ... output out=want...; run; proc report data=want...; ...
And report out that.
Why not do a simple proc sql group by, then proc report that?
I looked itno Proc means, which basically gives me the perecentages.
I don't quite understand how to link that to proc report.
You can create a dataset from your proc means:
proc means...; ... output out=want...; run; proc report data=want...; ...
And report out that.
That is all ?! - great, so easy.
Thanks!
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 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.
Ready to level-up your skills? Choose your own adventure.