BookmarkSubscribeRSS Feed
varmalh
Fluorite | Level 6

hi all,

can someone please advise how to get this question "BY USING ABOVE TABLES FIND OUT QUARTER WISE (QUARTER LIKE (FOR (JAN FEB MAR ) Q1, (JAN FEB MAR ) Q2,… and so on ) SEGEMENT WISE DISTINCT COUNT OF CUSTOMER AND THERE TOTAL_SPEND".....?

i have attached a screensort for the reference ......!

 

thanks and regards

varmalh

2 REPLIES 2
PGStats
Opal | Level 21

1) look up the definition of a quarter

2) look up function QTR() and format QTR.

3) try to at least write some code.

4) submit any question that arises to the Forum

 

in that order.

PG
varmalh
Fluorite | Level 6

Thanks PG,

I tried to write some codes and got stuck after 3 codes.

 

proc format;
value $mfmt "JAN","FEB","MAR"="Q1"
            "APR","MAY","JUN"="Q2"
            "JUL","AUG","SEP"="Q3"
            "OCT","NOV","DEC"="Q4";
run;
proc print data=customers ;
format month$mfmt.;
run;

data a;
set customers;
format month $mfmt.;
run;

proc sql;
create table j as select a.*,segment from a left join customer_seg on a.cust_id=customer_seg.cust_id;
quit;

please advise how to get the correct output.

 

Thanks

varmalh

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 727 views
  • 2 likes
  • 2 in conversation